diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0786875 --- /dev/null +++ b/.gitignore @@ -0,0 +1,163 @@ +######################### +# .gitignore file for Xcode4 / OS X Source projects +# +# Version 2.1 +# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects +# +# 2013 updates: +# - fixed the broken "save personal Schemes" +# - added line-by-line explanations for EVERYTHING (some were missing) +# +# NB: if you are storing "built" products, this WILL NOT WORK, +# and you should use a different .gitignore (or none at all) +# This file is for SOURCE projects, where there are many extra +# files that we want to exclude +# +######################### + +##### +# OS X temporary files that should never be committed +# +# c.f. http://www.westwind.com/reference/os-x/invisibles.html + +.DS_Store + +# c.f. http://www.westwind.com/reference/os-x/invisibles.html + +.Trashes + +# c.f. http://www.westwind.com/reference/os-x/invisibles.html + +*.swp + +# *.lock - this is used and abused by many editors for many different things. +# For the main ones I use (e.g. Eclipse), it should be excluded +# from source-control, but YMMV + +*.lock + +# +# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?) +#profile + + +#### +# Xcode temporary files that should never be committed +# +# NB: NIB/XIB files still exist even on Storyboard projects, so we want this... + +*~.nib + + +#### +# Xcode build files - +# +# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData" + +DerivedData/ + +# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build" + +build/ + + +##### +# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups) +# +# This is complicated: +# +# SOMETIMES you need to put this file in version control. +# Apple designed it poorly - if you use "custom executables", they are +# saved in this file. +# 99% of projects do NOT use those, so they do NOT want to version control this file. +# ..but if you're in the 1%, comment out the line "*.pbxuser" + +# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html + +*.pbxuser + +# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html + +*.mode1v3 + +# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html + +*.mode2v3 + +# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file + +*.perspectivev3 + +# NB: also, whitelist the default ones, some projects need to use these +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +#### +# Xcode 5 - checkout data +*.xccheckout + +#### +# Xcode 4 - semi-personal settings +# +# +# OPTION 1: --------------------------------- +# throw away ALL personal settings (including custom schemes! +# - unless they are "shared") +# +# NB: this is exclusive with OPTION 2 below +xcuserdata + +# OPTION 2: --------------------------------- +# get rid of ALL personal settings, but KEEP SOME OF THEM +# - NB: you must manually uncomment the bits you want to keep +# +# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X, +# or manually install git over the top of the OS X version +# NB: this is exclusive with OPTION 1 above +# +#xcuserdata/**/* + +# (requires option 2 above): Personal Schemes +# +#!xcuserdata/**/xcschemes/* + +#### +# XCode 4 workspaces - more detailed +# +# Workspaces are important! They are a core feature of Xcode - don't exclude them :) +# +# Workspace layout is quite spammy. For reference: +# +# /(root)/ +# /(project-name).xcodeproj/ +# project.pbxproj +# /project.xcworkspace/ +# contents.xcworkspacedata +# /xcuserdata/ +# /(your name)/xcuserdatad/ +# UserInterfaceState.xcuserstate +# /xcsshareddata/ +# /xcschemes/ +# (shared scheme name).xcscheme +# /xcuserdata/ +# /(your name)/xcuserdatad/ +# (private scheme).xcscheme +# xcschememanagement.plist +# +# + +#### +# Xcode 4 - Deprecated classes +# +# Allegedly, if you manually "deprecate" your classes, they get moved here. +# +# We're using source-control, so this is a "feature" that we do not want! + +*.moved-aside + +#### +# UNKNOWN: recommended by others, but I can't discover what these files are +# +# ...none. Everything is now explained. diff --git a/360 Driver.xcodeproj/project.pbxproj b/360 Driver.xcodeproj/project.pbxproj new file mode 100644 index 0000000..f53d082 --- /dev/null +++ b/360 Driver.xcodeproj/project.pbxproj @@ -0,0 +1,1586 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + 55B6383818C10F8E00CE933D /* Whole Driver */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 55B6383918C10F8E00CE933D /* Build configuration list for PBXAggregateTarget "Whole Driver" */; + buildPhases = ( + ); + dependencies = ( + 55B6383D18C10FA200CE933D /* PBXTargetDependency */, + 55B6383F18C10FA200CE933D /* PBXTargetDependency */, + 55B6384118C10FA200CE933D /* PBXTargetDependency */, + 55B6384318C10FA200CE933D /* PBXTargetDependency */, + 55B6384518C10FA200CE933D /* PBXTargetDependency */, + ); + name = "Whole Driver"; + productName = "Whole Driver"; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 3F9B7C0A1A729C1600149949 /* artworks.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3F9B7C091A729C1600149949 /* artworks.xcassets */; }; + 3FE789A01A701F3400FF4065 /* Pref360StyleKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE7899E1A701F3400FF4065 /* Pref360StyleKit.h */; }; + 3FE789A11A701F3400FF4065 /* Pref360StyleKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FE7899F1A701F3400FF4065 /* Pref360StyleKit.m */; }; + 3FE789A41A701FE200FF4065 /* MyWhole360Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE789A21A701FE200FF4065 /* MyWhole360Controller.h */; }; + 3FE789A51A701FE200FF4065 /* MyWhole360Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FE789A31A701FE200FF4065 /* MyWhole360Controller.m */; }; + 3FE789A81A70281200FF4065 /* MyBatteryMonitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE789A61A70281200FF4065 /* MyBatteryMonitor.h */; }; + 3FE789A91A70281200FF4065 /* MyBatteryMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FE789A71A70281200FF4065 /* MyBatteryMonitor.m */; }; + 3FE789AC1A70288F00FF4065 /* MyDeadZoneViewer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE789AA1A70288F00FF4065 /* MyDeadZoneViewer.h */; }; + 3FE789AD1A70288F00FF4065 /* MyDeadZoneViewer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FE789AB1A70288F00FF4065 /* MyDeadZoneViewer.m */; }; + 3FE789B01A70331C00FF4065 /* MyTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FE789AE1A70331C00FF4065 /* MyTrigger.h */; }; + 3FE789B11A70331C00FF4065 /* MyTrigger.m in Sources */ = {isa = PBXBuildFile; fileRef = 3FE789AF1A70331C00FF4065 /* MyTrigger.m */; }; + 551CDFF9196EEE76000869B6 /* Pref360ControlPref.xib in Resources */ = {isa = PBXBuildFile; fileRef = 551CDFFB196EEE76000869B6 /* Pref360ControlPref.xib */; }; + 553BDB44196DF3BA00D1F569 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 553BDB43196DF3BA00D1F569 /* IOKit.framework */; }; + 553BDB45196DF41500D1F569 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 553BDB43196DF3BA00D1F569 /* IOKit.framework */; }; + 553BDB46196DF41600D1F569 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 553BDB43196DF3BA00D1F569 /* IOKit.framework */; }; + 55699CD61971D96E00C40A31 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55699CD51971D96E00C40A31 /* Images.xcassets */; }; + 55699CD71971DA8100C40A31 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 55699CD51971D96E00C40A31 /* Images.xcassets */; }; + 55750C09190AFB5B0047FF41 /* DaemonLEDs.m in Sources */ = {isa = PBXBuildFile; fileRef = 55750C08190AFB5B0047FF41 /* DaemonLEDs.m */; }; + 55852E1F18D6B5580009BF55 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55852E2118D6B5580009BF55 /* Localizable.strings */; }; + 55A2B8D518C116BD006829A2 /* 360Daemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B637C718C10CB400CE933D /* 360Daemon.m */; }; + 55A2B8D818C116E0006829A2 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55A2B8DA18C116E0006829A2 /* Localizable.strings */; }; + 55A2B8DD18C11A2F006829A2 /* com.mice.360Daemon.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 55B637CD18C10CB400CE933D /* com.mice.360Daemon.plist */; }; + 55B636B818C104DB00CE933D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B636B718C104DB00CE933D /* Cocoa.framework */; }; + 55B636C218C104DB00CE933D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55B636C018C104DB00CE933D /* InfoPlist.strings */; }; + 55B6371618C1058E00CE933D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55B636F918C1054F00CE933D /* InfoPlist.strings */; }; + 55B6371718C105B800CE933D /* _60Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B636EF18C1054F00CE933D /* _60Controller.cpp */; }; + 55B6371818C105B800CE933D /* ChatPad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B636F118C1054F00CE933D /* ChatPad.cpp */; }; + 55B6371918C105B800CE933D /* chatpadkeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B636F418C1054F00CE933D /* chatpadkeys.cpp */; }; + 55B6371A18C105B800CE933D /* Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B636F618C1054F00CE933D /* Controller.cpp */; }; + 55B6372118C108A500CE933D /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B6372018C108A500CE933D /* CoreFoundation.framework */; }; + 55B6373C18C108D200CE933D /* devlink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B6372D18C108D200CE933D /* devlink.cpp */; }; + 55B6373D18C108D200CE933D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55B6372F18C108D200CE933D /* InfoPlist.strings */; }; + 55B6373E18C108D200CE933D /* Feedback360.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B6373118C108D200CE933D /* Feedback360.cpp */; }; + 55B6373F18C108D200CE933D /* Feedback360Effect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B6373618C108D200CE933D /* Feedback360Effect.cpp */; }; + 55B6374F18C1098D00CE933D /* _60Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636F018C1054F00CE933D /* _60Controller.h */; }; + 55B6375018C1098D00CE933D /* ChatPad.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636F218C1054F00CE933D /* ChatPad.h */; }; + 55B6375118C1098D00CE933D /* chatpadhid.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636F318C1054F00CE933D /* chatpadhid.h */; }; + 55B6375218C1098D00CE933D /* chatpadkeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636F518C1054F00CE933D /* chatpadkeys.h */; }; + 55B6375318C1098D00CE933D /* Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636F718C1054F00CE933D /* Controller.h */; }; + 55B6375418C1098D00CE933D /* ControlStruct.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636F818C1054F00CE933D /* ControlStruct.h */; }; + 55B6375518C1098D00CE933D /* xbox360hid.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B636FD18C1054F00CE933D /* xbox360hid.h */; }; + 55B6375718C1099F00CE933D /* Feedback360.plugin in Copy PlugIns */ = {isa = PBXBuildFile; fileRef = 55B6371F18C108A500CE933D /* Feedback360.plugin */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 55B6375918C109E600CE933D /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B6375818C109E600CE933D /* ForceFeedback.framework */; }; + 55B6377218C10A5400CE933D /* DriverTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B6376C18C10A5400CE933D /* DriverTool.m */; }; + 55B6377618C10ACC00CE933D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B636BC18C104DB00CE933D /* Foundation.framework */; }; + 55B6377E18C10B0B00CE933D /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B636B718C104DB00CE933D /* Cocoa.framework */; }; + 55B6378018C10B0B00CE933D /* PreferencePanes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B6377F18C10B0B00CE933D /* PreferencePanes.framework */; }; + 55B6378618C10B0B00CE933D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55B6378418C10B0B00CE933D /* InfoPlist.strings */; }; + 55B637AA18C10C0C00CE933D /* DeviceItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B6379A18C10C0C00CE933D /* DeviceItem.h */; }; + 55B637AB18C10C0C00CE933D /* DeviceItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B6379B18C10C0C00CE933D /* DeviceItem.m */; }; + 55B637AC18C10C0C00CE933D /* DeviceLister.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B6379C18C10C0C00CE933D /* DeviceLister.h */; }; + 55B637AD18C10C0C00CE933D /* DeviceLister.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B6379D18C10C0C00CE933D /* DeviceLister.m */; }; + 55B637B818C10C0C00CE933D /* Pref360ControlPref.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B637A818C10C0C00CE933D /* Pref360ControlPref.h */; }; + 55B637B918C10C0C00CE933D /* Pref360ControlPref.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B637A918C10C0C00CE933D /* Pref360ControlPref.m */; }; + 55B637C018C10C2400CE933D /* pref360controlpref.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 55B637BC18C10C2400CE933D /* pref360controlpref.tiff */; }; + 55B637D318C10CB400CE933D /* Alert.tif in Resources */ = {isa = PBXBuildFile; fileRef = 55B637CC18C10CB400CE933D /* Alert.tif */; }; + 55B637D518C10CB400CE933D /* ControlPrefs.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B637CF18C10CB400CE933D /* ControlPrefs.m */; }; + 55B637DD18C10CCC00CE933D /* ControlPrefs.m in Sources */ = {isa = PBXBuildFile; fileRef = 55B637CF18C10CB400CE933D /* ControlPrefs.m */; }; + 55B637DF18C10CFE00CE933D /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B637DE18C10CFE00CE933D /* Security.framework */; }; + 55B637E018C10D0D00CE933D /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B6375818C109E600CE933D /* ForceFeedback.framework */; }; + 55B6380018C10DA300CE933D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55B637F718C10DA300CE933D /* InfoPlist.strings */; }; + 55B6380318C10DA300CE933D /* Wireless360Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B637FB18C10DA300CE933D /* Wireless360Controller.cpp */; }; + 55B6380418C10DA300CE933D /* Wireless360Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B637FC18C10DA300CE933D /* Wireless360Controller.h */; }; + 55B6382B18C10EBE00CE933D /* devices.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B6381D18C10EBE00CE933D /* devices.h */; }; + 55B6382C18C10EBE00CE933D /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 55B6381E18C10EBE00CE933D /* InfoPlist.strings */; }; + 55B6382F18C10EBE00CE933D /* WirelessDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B6382218C10EBE00CE933D /* WirelessDevice.cpp */; }; + 55B6383018C10EBE00CE933D /* WirelessDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B6382318C10EBE00CE933D /* WirelessDevice.h */; }; + 55B6383118C10EBE00CE933D /* WirelessGamingReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B6382418C10EBE00CE933D /* WirelessGamingReceiver.cpp */; }; + 55B6383218C10EBE00CE933D /* WirelessGamingReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B6382518C10EBE00CE933D /* WirelessGamingReceiver.h */; }; + 55B6383318C10EBE00CE933D /* WirelessHIDDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 55B6382918C10EBE00CE933D /* WirelessHIDDevice.cpp */; }; + 55B6383418C10EBE00CE933D /* WirelessHIDDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 55B6382A18C10EBE00CE933D /* WirelessHIDDevice.h */; }; + 55B6384618C10FE200CE933D /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B6375818C109E600CE933D /* ForceFeedback.framework */; }; + 55F7E7C319D8C32000525388 /* DriverTool in Copy Tools */ = {isa = PBXBuildFile; fileRef = 55B6376018C10A3200CE933D /* DriverTool */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 55FE3CA218D7B77800D69E84 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55B6372018C108A500CE933D /* CoreFoundation.framework */; }; + 55FE3CAB18D7B78D00D69E84 /* testhaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 55B6373918C108D200CE933D /* testhaptic.c */; }; + 55FE3CAD18D7B7B600D69E84 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 55FE3CAC18D7B7B600D69E84 /* SDL2.framework */; }; + 5B943BE11A83EC6600E77A79 /* MyAnalogStick.h in Headers */ = {isa = PBXBuildFile; fileRef = 5B943BDF1A83EC6600E77A79 /* MyAnalogStick.h */; }; + 5B943BE21A83EC6600E77A79 /* MyAnalogStick.m in Sources */ = {isa = PBXBuildFile; fileRef = 5B943BE01A83EC6600E77A79 /* MyAnalogStick.m */; }; + 622A73C21A7C339000784C02 /* MyWhole360ControllerMapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 622A73C01A7C339000784C02 /* MyWhole360ControllerMapper.h */; }; + 622A73C31A7C339000784C02 /* MyWhole360ControllerMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 622A73C11A7C339000784C02 /* MyWhole360ControllerMapper.m */; }; + 622A73CE1A7C879300784C02 /* BindingTableView.h in Headers */ = {isa = PBXBuildFile; fileRef = 622A73CC1A7C879300784C02 /* BindingTableView.h */; }; + 622A73CF1A7C879300784C02 /* BindingTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 622A73CD1A7C879300784C02 /* BindingTableView.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 55B6374D18C1097D00CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B6371E18C108A500CE933D; + remoteInfo = Feedback360; + }; + 55B637C218C10C5600CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B6375F18C10A3200CE933D; + remoteInfo = DriverTool; + }; + 55B6383C18C10FA200CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B636B318C104DB00CE933D; + remoteInfo = 360DaemonApp; + }; + 55B6383E18C10FA200CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B6370618C1057100CE933D; + remoteInfo = 360Controller; + }; + 55B6384018C10FA200CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B6377C18C10B0B00CE933D; + remoteInfo = Pref360Control; + }; + 55B6384218C10FA200CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B637E718C10D5000CE933D; + remoteInfo = Wireless360Controller; + }; + 55B6384418C10FA200CE933D /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B6380D18C10E8700CE933D; + remoteInfo = WirelessGamingReceiver; + }; + 55DA7C6C1926BED3002F6A3A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 55B636AC18C104DB00CE933D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 55B6371E18C108A500CE933D; + remoteInfo = Feedback360; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 55A2B8DC18C11A21006829A2 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = "${LOCAL_LIBRARY_DIR}/LaunchDaemons"; + dstSubfolderSpec = 0; + files = ( + 55A2B8DD18C11A2F006829A2 /* com.mice.360Daemon.plist in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + 55B6375618C1099700CE933D /* Copy PlugIns */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 13; + files = ( + 55B6375718C1099F00CE933D /* Feedback360.plugin in Copy PlugIns */, + ); + name = "Copy PlugIns"; + runOnlyForDeploymentPostprocessing = 0; + }; + 55F7E7C219D8C31300525388 /* Copy Tools */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 7; + files = ( + 55F7E7C319D8C32000525388 /* DriverTool in Copy Tools */, + ); + name = "Copy Tools"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3F9B7C091A729C1600149949 /* artworks.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = artworks.xcassets; path = Resources/artworks.xcassets; sourceTree = ""; }; + 3FE7899E1A701F3400FF4065 /* Pref360StyleKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pref360StyleKit.h; sourceTree = ""; }; + 3FE7899F1A701F3400FF4065 /* Pref360StyleKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Pref360StyleKit.m; sourceTree = ""; }; + 3FE789A21A701FE200FF4065 /* MyWhole360Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyWhole360Controller.h; sourceTree = ""; }; + 3FE789A31A701FE200FF4065 /* MyWhole360Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyWhole360Controller.m; sourceTree = ""; }; + 3FE789A61A70281200FF4065 /* MyBatteryMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyBatteryMonitor.h; sourceTree = ""; }; + 3FE789A71A70281200FF4065 /* MyBatteryMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyBatteryMonitor.m; sourceTree = ""; }; + 3FE789AA1A70288F00FF4065 /* MyDeadZoneViewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyDeadZoneViewer.h; sourceTree = ""; }; + 3FE789AB1A70288F00FF4065 /* MyDeadZoneViewer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyDeadZoneViewer.m; sourceTree = ""; }; + 3FE789AE1A70331C00FF4065 /* MyTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyTrigger.h; sourceTree = ""; }; + 3FE789AF1A70331C00FF4065 /* MyTrigger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTrigger.m; sourceTree = ""; }; + 551B911F1A68BDB000EA6527 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/Pref360ControlPref.xib; sourceTree = ""; }; + 551CDFFD196EF52F000869B6 /* Pref360Control_Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Pref360Control_Prefix.pch; sourceTree = ""; }; + 551CDFFF196EFD34000869B6 /* Install360Controller.pkgproj */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Install360Controller.pkgproj; sourceTree = ""; }; + 551CE001196EFD34000869B6 /* finish.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = finish.sh; sourceTree = ""; }; + 551CE002196EFD34000869B6 /* upgrade.sh */ = {isa = PBXFileReference; indentWidth = 3; lastKnownFileType = text.script.sh; path = upgrade.sh; sourceTree = ""; }; + 551CE004196EFD34000869B6 /* Welcome.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Welcome.rtf; sourceTree = ""; }; + 553BDB43196DF3BA00D1F569 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; + 55699CD51971D96E00C40A31 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 55750C07190AFB5B0047FF41 /* DaemonLEDs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DaemonLEDs.h; sourceTree = ""; usesTabs = 1; }; + 55750C08190AFB5B0047FF41 /* DaemonLEDs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DaemonLEDs.m; sourceTree = ""; usesTabs = 1; }; + 55852E2018D6B5580009BF55 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 55A2B8DB18C116E2006829A2 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 55B13FC018C51DD400ACD9AC /* Feedback360.exp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.exports; path = Feedback360.exp; sourceTree = ""; }; + 55B636B418C104DB00CE933D /* 360Daemon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = 360Daemon.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B636B718C104DB00CE933D /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 55B636BA18C104DB00CE933D /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 55B636BB18C104DB00CE933D /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 55B636BC18C104DB00CE933D /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 55B636BF18C104DB00CE933D /* 360DaemonApp-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "360DaemonApp-Info.plist"; sourceTree = ""; }; + 55B636C118C104DB00CE933D /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 55B636C518C104DB00CE933D /* 360DaemonApp-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "360DaemonApp-Prefix.pch"; sourceTree = ""; }; + 55B636EF18C1054F00CE933D /* _60Controller.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = _60Controller.cpp; sourceTree = ""; }; + 55B636F018C1054F00CE933D /* _60Controller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _60Controller.h; sourceTree = ""; }; + 55B636F118C1054F00CE933D /* ChatPad.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ChatPad.cpp; sourceTree = ""; }; + 55B636F218C1054F00CE933D /* ChatPad.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChatPad.h; sourceTree = ""; }; + 55B636F318C1054F00CE933D /* chatpadhid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = chatpadhid.h; sourceTree = ""; }; + 55B636F418C1054F00CE933D /* chatpadkeys.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = chatpadkeys.cpp; sourceTree = ""; usesTabs = 1; }; + 55B636F518C1054F00CE933D /* chatpadkeys.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = chatpadkeys.h; sourceTree = ""; }; + 55B636F618C1054F00CE933D /* Controller.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Controller.cpp; sourceTree = ""; }; + 55B636F718C1054F00CE933D /* Controller.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = ""; }; + 55B636F818C1054F00CE933D /* ControlStruct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ControlStruct.h; sourceTree = ""; }; + 55B636FA18C1054F00CE933D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 55B636FB18C1054F00CE933D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55B636FD18C1054F00CE933D /* xbox360hid.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xbox360hid.h; sourceTree = ""; }; + 55B6370718C1057100CE933D /* 360Controller.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = 360Controller.kext; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B6370818C1057100CE933D /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = System/Library/Frameworks/Kernel.framework; sourceTree = SDKROOT; }; + 55B6371F18C108A500CE933D /* Feedback360.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Feedback360.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B6372018C108A500CE933D /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + 55B6372D18C108D200CE933D /* devlink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = devlink.cpp; sourceTree = ""; }; + 55B6372E18C108D200CE933D /* devlink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = devlink.h; sourceTree = ""; }; + 55B6373018C108D200CE933D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 55B6373118C108D200CE933D /* Feedback360.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Feedback360.cpp; sourceTree = ""; }; + 55B6373218C108D200CE933D /* Feedback360.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Feedback360.h; sourceTree = ""; }; + 55B6373618C108D200CE933D /* Feedback360Effect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Feedback360Effect.cpp; sourceTree = ""; }; + 55B6373718C108D200CE933D /* Feedback360Effect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Feedback360Effect.h; sourceTree = ""; usesTabs = 1; }; + 55B6373818C108D200CE933D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55B6373918C108D200CE933D /* testhaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testhaptic.c; sourceTree = ""; }; + 55B6373A18C108D200CE933D /* testrumble.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testrumble.c; sourceTree = ""; }; + 55B6375818C109E600CE933D /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = System/Library/Frameworks/ForceFeedback.framework; sourceTree = SDKROOT; }; + 55B6376018C10A3200CE933D /* DriverTool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DriverTool; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B6376C18C10A5400CE933D /* DriverTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DriverTool.m; sourceTree = ""; }; + 55B6377018C10A5400CE933D /* DriverTool_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DriverTool_Prefix.pch; sourceTree = ""; }; + 55B6377118C10A5400CE933D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55B6377D18C10B0B00CE933D /* Pref360Control.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Pref360Control.prefPane; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B6377F18C10B0B00CE933D /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = System/Library/Frameworks/PreferencePanes.framework; sourceTree = SDKROOT; }; + 55B6378518C10B0B00CE933D /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 55B6379A18C10C0C00CE933D /* DeviceItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceItem.h; sourceTree = ""; }; + 55B6379B18C10C0C00CE933D /* DeviceItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceItem.m; sourceTree = ""; }; + 55B6379C18C10C0C00CE933D /* DeviceLister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceLister.h; sourceTree = ""; }; + 55B6379D18C10C0C00CE933D /* DeviceLister.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceLister.m; sourceTree = ""; }; + 55B637A818C10C0C00CE933D /* Pref360ControlPref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pref360ControlPref.h; sourceTree = ""; }; + 55B637A918C10C0C00CE933D /* Pref360ControlPref.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Pref360ControlPref.m; sourceTree = ""; }; + 55B637BB18C10C2400CE933D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55B637BC18C10C2400CE933D /* pref360controlpref.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = pref360controlpref.tiff; sourceTree = ""; }; + 55B637C718C10CB400CE933D /* 360Daemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = 360Daemon.m; sourceTree = ""; }; + 55B637CC18C10CB400CE933D /* Alert.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Alert.tif; sourceTree = ""; }; + 55B637CD18C10CB400CE933D /* com.mice.360Daemon.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.mice.360Daemon.plist; sourceTree = ""; }; + 55B637CE18C10CB400CE933D /* ControlPrefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPrefs.h; sourceTree = ""; }; + 55B637CF18C10CB400CE933D /* ControlPrefs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ControlPrefs.m; sourceTree = ""; }; + 55B637DE18C10CFE00CE933D /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 55B637E818C10D5000CE933D /* Wireless360Controller.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Wireless360Controller.kext; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B637F818C10DA300CE933D /* English */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 55B637F918C10DA300CE933D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55B637FB18C10DA300CE933D /* Wireless360Controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Wireless360Controller.cpp; sourceTree = ""; }; + 55B637FC18C10DA300CE933D /* Wireless360Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wireless360Controller.h; sourceTree = ""; }; + 55B6380E18C10E8700CE933D /* WirelessGamingReceiver.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WirelessGamingReceiver.kext; sourceTree = BUILT_PRODUCTS_DIR; }; + 55B6381D18C10EBE00CE933D /* devices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = devices.h; sourceTree = ""; }; + 55B6381F18C10EBE00CE933D /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 55B6382018C10EBE00CE933D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 55B6382218C10EBE00CE933D /* WirelessDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WirelessDevice.cpp; sourceTree = ""; }; + 55B6382318C10EBE00CE933D /* WirelessDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WirelessDevice.h; sourceTree = ""; }; + 55B6382418C10EBE00CE933D /* WirelessGamingReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WirelessGamingReceiver.cpp; sourceTree = ""; }; + 55B6382518C10EBE00CE933D /* WirelessGamingReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WirelessGamingReceiver.h; sourceTree = ""; }; + 55B6382918C10EBE00CE933D /* WirelessHIDDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WirelessHIDDevice.cpp; sourceTree = ""; }; + 55B6382A18C10EBE00CE933D /* WirelessHIDDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WirelessHIDDevice.h; sourceTree = ""; }; + 55E1C62819708E7300EC9DD8 /* build.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = build.sh; sourceTree = SOURCE_ROOT; }; + 55E1C62919708E7300EC9DD8 /* clean.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = clean.sh; sourceTree = SOURCE_ROOT; }; + 55E1C62A19708F8600EC9DD8 /* Readme.md */ = {isa = PBXFileReference; lastKnownFileType = text; path = Readme.md; sourceTree = SOURCE_ROOT; }; + 55FE3CA118D7B77800D69E84 /* testhaptic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhaptic; sourceTree = BUILT_PRODUCTS_DIR; }; + 55FE3CAC18D7B7B600D69E84 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = ""; }; + 5B943BDF1A83EC6600E77A79 /* MyAnalogStick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyAnalogStick.h; sourceTree = ""; }; + 5B943BE01A83EC6600E77A79 /* MyAnalogStick.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyAnalogStick.m; sourceTree = ""; }; + 622A73C01A7C339000784C02 /* MyWhole360ControllerMapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyWhole360ControllerMapper.h; sourceTree = ""; }; + 622A73C11A7C339000784C02 /* MyWhole360ControllerMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyWhole360ControllerMapper.m; sourceTree = ""; }; + 622A73CC1A7C879300784C02 /* BindingTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BindingTableView.h; sourceTree = ""; }; + 622A73CD1A7C879300784C02 /* BindingTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BindingTableView.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 55B636B118C104DB00CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B636B818C104DB00CE933D /* Cocoa.framework in Frameworks */, + 55B6384618C10FE200CE933D /* ForceFeedback.framework in Frameworks */, + 553BDB45196DF41500D1F569 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6370218C1057100CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6371C18C108A500CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 553BDB44196DF3BA00D1F569 /* IOKit.framework in Frameworks */, + 55B6375918C109E600CE933D /* ForceFeedback.framework in Frameworks */, + 55B6372118C108A500CE933D /* CoreFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6375D18C10A3200CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6377618C10ACC00CE933D /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6377818C10B0B00CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B637E018C10D0D00CE933D /* ForceFeedback.framework in Frameworks */, + 55B637DF18C10CFE00CE933D /* Security.framework in Frameworks */, + 55B6377E18C10B0B00CE933D /* Cocoa.framework in Frameworks */, + 55B6378018C10B0B00CE933D /* PreferencePanes.framework in Frameworks */, + 553BDB46196DF41600D1F569 /* IOKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B637E318C10D5000CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6380918C10E8700CE933D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55FE3C9E18D7B77800D69E84 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 55FE3CAD18D7B7B600D69E84 /* SDL2.framework in Frameworks */, + 55FE3CA218D7B77800D69E84 /* CoreFoundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 551CDFFE196EFD0A000869B6 /* Distribution */ = { + isa = PBXGroup; + children = ( + 551CDFFF196EFD34000869B6 /* Install360Controller.pkgproj */, + 551CE000196EFD34000869B6 /* Scripts */, + 551CE003196EFD34000869B6 /* Text */, + ); + name = Distribution; + path = Install360Controller; + sourceTree = ""; + }; + 551CE000196EFD34000869B6 /* Scripts */ = { + isa = PBXGroup; + children = ( + 55E1C62819708E7300EC9DD8 /* build.sh */, + 55E1C62919708E7300EC9DD8 /* clean.sh */, + 551CE001196EFD34000869B6 /* finish.sh */, + 551CE002196EFD34000869B6 /* upgrade.sh */, + ); + path = Scripts; + sourceTree = ""; + }; + 551CE003196EFD34000869B6 /* Text */ = { + isa = PBXGroup; + children = ( + 55E1C62A19708F8600EC9DD8 /* Readme.md */, + 551CE004196EFD34000869B6 /* Welcome.rtf */, + ); + path = Text; + sourceTree = ""; + }; + 55A2B8E018C11C7E006829A2 /* Resources */ = { + isa = PBXGroup; + children = ( + 55B6372F18C108D200CE933D /* InfoPlist.strings */, + 55B6373818C108D200CE933D /* Info.plist */, + 55B13FC018C51DD400ACD9AC /* Feedback360.exp */, + ); + name = Resources; + sourceTree = ""; + }; + 55A2B8E118C11C8F006829A2 /* Source code */ = { + isa = PBXGroup; + children = ( + 55B6372E18C108D200CE933D /* devlink.h */, + 55B6372D18C108D200CE933D /* devlink.cpp */, + 55B6373218C108D200CE933D /* Feedback360.h */, + 55B6373118C108D200CE933D /* Feedback360.cpp */, + 55B6373718C108D200CE933D /* Feedback360Effect.h */, + 55B6373618C108D200CE933D /* Feedback360Effect.cpp */, + ); + name = "Source code"; + sourceTree = ""; + }; + 55A2B8E218C11D4D006829A2 /* Resources */ = { + isa = PBXGroup; + children = ( + 55B636F918C1054F00CE933D /* InfoPlist.strings */, + 55B636FB18C1054F00CE933D /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 55A2B8E318C11DAD006829A2 /* Resources */ = { + isa = PBXGroup; + children = ( + 55B637F718C10DA300CE933D /* InfoPlist.strings */, + 55B637F918C10DA300CE933D /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 55A2B8E418C11DC5006829A2 /* Resources */ = { + isa = PBXGroup; + children = ( + 55B6381E18C10EBE00CE933D /* InfoPlist.strings */, + 55B6382018C10EBE00CE933D /* Info.plist */, + ); + name = Resources; + sourceTree = ""; + }; + 55B636AB18C104DB00CE933D = { + isa = PBXGroup; + children = ( + 55B6372C18C108D200CE933D /* Feedback360 */, + 55B636EB18C1054F00CE933D /* 360Controller */, + 55B637F618C10DA300CE933D /* Wireless360Controller */, + 55B6381C18C10EBE00CE933D /* WirelessGamingReceiver */, + 55B636BD18C104DB00CE933D /* 360Daemon */, + 55B6376A18C10A5400CE933D /* DriverTool */, + 55B6378118C10B0B00CE933D /* Pref360Control */, + 551CDFFE196EFD0A000869B6 /* Distribution */, + 55B636B618C104DB00CE933D /* Frameworks */, + 55B636B518C104DB00CE933D /* Products */, + ); + sourceTree = ""; + usesTabs = 0; + }; + 55B636B518C104DB00CE933D /* Products */ = { + isa = PBXGroup; + children = ( + 55B636B418C104DB00CE933D /* 360Daemon.app */, + 55B6370718C1057100CE933D /* 360Controller.kext */, + 55B6371F18C108A500CE933D /* Feedback360.plugin */, + 55B6376018C10A3200CE933D /* DriverTool */, + 55B6377D18C10B0B00CE933D /* Pref360Control.prefPane */, + 55B637E818C10D5000CE933D /* Wireless360Controller.kext */, + 55B6380E18C10E8700CE933D /* WirelessGamingReceiver.kext */, + 55FE3CA118D7B77800D69E84 /* testhaptic */, + ); + name = Products; + sourceTree = ""; + }; + 55B636B618C104DB00CE933D /* Frameworks */ = { + isa = PBXGroup; + children = ( + 55FE3CAC18D7B7B600D69E84 /* SDL2.framework */, + 553BDB43196DF3BA00D1F569 /* IOKit.framework */, + 55B637DE18C10CFE00CE933D /* Security.framework */, + 55B6375818C109E600CE933D /* ForceFeedback.framework */, + 55B636B718C104DB00CE933D /* Cocoa.framework */, + 55B6372018C108A500CE933D /* CoreFoundation.framework */, + 55B6377F18C10B0B00CE933D /* PreferencePanes.framework */, + 55B636B918C104DB00CE933D /* Other Frameworks */, + ); + name = Frameworks; + path = System/Library/Frameworks; + sourceTree = SDKROOT; + }; + 55B636B918C104DB00CE933D /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 55B636BA18C104DB00CE933D /* AppKit.framework */, + 55B636BB18C104DB00CE933D /* CoreData.framework */, + 55B636BC18C104DB00CE933D /* Foundation.framework */, + 55B6370818C1057100CE933D /* Kernel.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 55B636BD18C104DB00CE933D /* 360Daemon */ = { + isa = PBXGroup; + children = ( + 55B637C718C10CB400CE933D /* 360Daemon.m */, + 55B637CE18C10CB400CE933D /* ControlPrefs.h */, + 55B637CF18C10CB400CE933D /* ControlPrefs.m */, + 55750C07190AFB5B0047FF41 /* DaemonLEDs.h */, + 55750C08190AFB5B0047FF41 /* DaemonLEDs.m */, + 55699CD51971D96E00C40A31 /* Images.xcassets */, + 55B636BE18C104DB00CE933D /* Supporting Files */, + ); + path = 360Daemon; + sourceTree = ""; + }; + 55B636BE18C104DB00CE933D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 55B637CC18C10CB400CE933D /* Alert.tif */, + 55B637CD18C10CB400CE933D /* com.mice.360Daemon.plist */, + 55B636BF18C104DB00CE933D /* 360DaemonApp-Info.plist */, + 55B636C018C104DB00CE933D /* InfoPlist.strings */, + 55B636C518C104DB00CE933D /* 360DaemonApp-Prefix.pch */, + 55A2B8DA18C116E0006829A2 /* Localizable.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 55B636EB18C1054F00CE933D /* 360Controller */ = { + isa = PBXGroup; + children = ( + 55B636F018C1054F00CE933D /* _60Controller.h */, + 55B636EF18C1054F00CE933D /* _60Controller.cpp */, + 55B636F218C1054F00CE933D /* ChatPad.h */, + 55B636F118C1054F00CE933D /* ChatPad.cpp */, + 55B636F318C1054F00CE933D /* chatpadhid.h */, + 55B636F518C1054F00CE933D /* chatpadkeys.h */, + 55B636F418C1054F00CE933D /* chatpadkeys.cpp */, + 55B636F718C1054F00CE933D /* Controller.h */, + 55B636F618C1054F00CE933D /* Controller.cpp */, + 55B636F818C1054F00CE933D /* ControlStruct.h */, + 55B636FD18C1054F00CE933D /* xbox360hid.h */, + 55A2B8E218C11D4D006829A2 /* Resources */, + ); + path = 360Controller; + sourceTree = ""; + }; + 55B6372C18C108D200CE933D /* Feedback360 */ = { + isa = PBXGroup; + children = ( + 55A2B8E118C11C8F006829A2 /* Source code */, + 55B6373918C108D200CE933D /* testhaptic.c */, + 55B6373A18C108D200CE933D /* testrumble.c */, + 55A2B8E018C11C7E006829A2 /* Resources */, + ); + path = Feedback360; + sourceTree = ""; + }; + 55B6376A18C10A5400CE933D /* DriverTool */ = { + isa = PBXGroup; + children = ( + 55B6376C18C10A5400CE933D /* DriverTool.m */, + 55B6377018C10A5400CE933D /* DriverTool_Prefix.pch */, + 55B6377118C10A5400CE933D /* Info.plist */, + ); + path = DriverTool; + sourceTree = ""; + }; + 55B6378118C10B0B00CE933D /* Pref360Control */ = { + isa = PBXGroup; + children = ( + 3FE7899E1A701F3400FF4065 /* Pref360StyleKit.h */, + 3FE7899F1A701F3400FF4065 /* Pref360StyleKit.m */, + 55B6379A18C10C0C00CE933D /* DeviceItem.h */, + 55B6379B18C10C0C00CE933D /* DeviceItem.m */, + 55B6379C18C10C0C00CE933D /* DeviceLister.h */, + 55B6379D18C10C0C00CE933D /* DeviceLister.m */, + 3FE789A21A701FE200FF4065 /* MyWhole360Controller.h */, + 3FE789A31A701FE200FF4065 /* MyWhole360Controller.m */, + 622A73C01A7C339000784C02 /* MyWhole360ControllerMapper.h */, + 622A73C11A7C339000784C02 /* MyWhole360ControllerMapper.m */, + 622A73CC1A7C879300784C02 /* BindingTableView.h */, + 622A73CD1A7C879300784C02 /* BindingTableView.m */, + 3FE789A61A70281200FF4065 /* MyBatteryMonitor.h */, + 3FE789A71A70281200FF4065 /* MyBatteryMonitor.m */, + 3FE789AA1A70288F00FF4065 /* MyDeadZoneViewer.h */, + 3FE789AB1A70288F00FF4065 /* MyDeadZoneViewer.m */, + 5B943BDF1A83EC6600E77A79 /* MyAnalogStick.h */, + 5B943BE01A83EC6600E77A79 /* MyAnalogStick.m */, + 3FE789AE1A70331C00FF4065 /* MyTrigger.h */, + 3FE789AF1A70331C00FF4065 /* MyTrigger.m */, + 55B637A818C10C0C00CE933D /* Pref360ControlPref.h */, + 55B637A918C10C0C00CE933D /* Pref360ControlPref.m */, + 551CDFFB196EEE76000869B6 /* Pref360ControlPref.xib */, + 55B6378218C10B0B00CE933D /* Supporting Files */, + ); + path = Pref360Control; + sourceTree = ""; + }; + 55B6378218C10B0B00CE933D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 55B637BB18C10C2400CE933D /* Info.plist */, + 551CDFFD196EF52F000869B6 /* Pref360Control_Prefix.pch */, + 55B637BC18C10C2400CE933D /* pref360controlpref.tiff */, + 55B6378418C10B0B00CE933D /* InfoPlist.strings */, + 55852E2118D6B5580009BF55 /* Localizable.strings */, + 3F9B7C091A729C1600149949 /* artworks.xcassets */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 55B637F618C10DA300CE933D /* Wireless360Controller */ = { + isa = PBXGroup; + children = ( + 55B637FC18C10DA300CE933D /* Wireless360Controller.h */, + 55B637FB18C10DA300CE933D /* Wireless360Controller.cpp */, + 55A2B8E318C11DAD006829A2 /* Resources */, + ); + path = Wireless360Controller; + sourceTree = ""; + }; + 55B6381C18C10EBE00CE933D /* WirelessGamingReceiver */ = { + isa = PBXGroup; + children = ( + 55B6381D18C10EBE00CE933D /* devices.h */, + 55B6382318C10EBE00CE933D /* WirelessDevice.h */, + 55B6382218C10EBE00CE933D /* WirelessDevice.cpp */, + 55B6382518C10EBE00CE933D /* WirelessGamingReceiver.h */, + 55B6382418C10EBE00CE933D /* WirelessGamingReceiver.cpp */, + 55B6382A18C10EBE00CE933D /* WirelessHIDDevice.h */, + 55B6382918C10EBE00CE933D /* WirelessHIDDevice.cpp */, + 55A2B8E418C11DC5006829A2 /* Resources */, + ); + path = WirelessGamingReceiver; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 55B6370318C1057100CE933D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6375218C1098D00CE933D /* chatpadkeys.h in Headers */, + 55B6375318C1098D00CE933D /* Controller.h in Headers */, + 55B6375518C1098D00CE933D /* xbox360hid.h in Headers */, + 55B6375018C1098D00CE933D /* ChatPad.h in Headers */, + 55B6375118C1098D00CE933D /* chatpadhid.h in Headers */, + 55B6374F18C1098D00CE933D /* _60Controller.h in Headers */, + 55B6375418C1098D00CE933D /* ControlStruct.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6377918C10B0B00CE933D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 5B943BE11A83EC6600E77A79 /* MyAnalogStick.h in Headers */, + 3FE789A81A70281200FF4065 /* MyBatteryMonitor.h in Headers */, + 3FE789A01A701F3400FF4065 /* Pref360StyleKit.h in Headers */, + 3FE789AC1A70288F00FF4065 /* MyDeadZoneViewer.h in Headers */, + 3FE789B01A70331C00FF4065 /* MyTrigger.h in Headers */, + 3FE789A41A701FE200FF4065 /* MyWhole360Controller.h in Headers */, + 622A73C21A7C339000784C02 /* MyWhole360ControllerMapper.h in Headers */, + 55B637AA18C10C0C00CE933D /* DeviceItem.h in Headers */, + 55B637AC18C10C0C00CE933D /* DeviceLister.h in Headers */, + 55B637B818C10C0C00CE933D /* Pref360ControlPref.h in Headers */, + 622A73CE1A7C879300784C02 /* BindingTableView.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B637E418C10D5000CE933D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6380418C10DA300CE933D /* Wireless360Controller.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6380A18C10E8700CE933D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6383418C10EBE00CE933D /* WirelessHIDDevice.h in Headers */, + 55B6383018C10EBE00CE933D /* WirelessDevice.h in Headers */, + 55B6383218C10EBE00CE933D /* WirelessGamingReceiver.h in Headers */, + 55B6382B18C10EBE00CE933D /* devices.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 55B636B318C104DB00CE933D /* 360Daemon */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B636E518C104DB00CE933D /* Build configuration list for PBXNativeTarget "360Daemon" */; + buildPhases = ( + 55B636B018C104DB00CE933D /* Sources */, + 55B636B118C104DB00CE933D /* Frameworks */, + 55B636B218C104DB00CE933D /* Resources */, + 55A2B8DC18C11A21006829A2 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = 360Daemon; + productName = 360DaemonApp; + productReference = 55B636B418C104DB00CE933D /* 360Daemon.app */; + productType = "com.apple.product-type.application"; + }; + 55B6370618C1057100CE933D /* 360Controller */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B6371318C1057100CE933D /* Build configuration list for PBXNativeTarget "360Controller" */; + buildPhases = ( + 55B6370118C1057100CE933D /* Sources */, + 55B6370218C1057100CE933D /* Frameworks */, + 55B6370318C1057100CE933D /* Headers */, + 55B6370418C1057100CE933D /* Resources */, + 55B6375618C1099700CE933D /* Copy PlugIns */, + ); + buildRules = ( + ); + dependencies = ( + 55B6374E18C1097D00CE933D /* PBXTargetDependency */, + ); + name = 360Controller; + productName = 360Controller2; + productReference = 55B6370718C1057100CE933D /* 360Controller.kext */; + productType = "com.apple.product-type.kernel-extension"; + }; + 55B6371E18C108A500CE933D /* Feedback360 */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B6372918C108A500CE933D /* Build configuration list for PBXNativeTarget "Feedback360" */; + buildPhases = ( + 55B6371B18C108A500CE933D /* Sources */, + 55B6371C18C108A500CE933D /* Frameworks */, + 55B6371D18C108A500CE933D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Feedback360; + productName = Feedback3602; + productReference = 55B6371F18C108A500CE933D /* Feedback360.plugin */; + productType = "com.apple.product-type.bundle"; + }; + 55B6375F18C10A3200CE933D /* DriverTool */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B6376718C10A3200CE933D /* Build configuration list for PBXNativeTarget "DriverTool" */; + buildPhases = ( + 55B6375C18C10A3200CE933D /* Sources */, + 55B6375D18C10A3200CE933D /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = DriverTool; + productName = DriverTool2; + productReference = 55B6376018C10A3200CE933D /* DriverTool */; + productType = "com.apple.product-type.tool"; + }; + 55B6377C18C10B0B00CE933D /* Pref360Control */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B6379018C10B0B00CE933D /* Build configuration list for PBXNativeTarget "Pref360Control" */; + buildPhases = ( + 55B6377718C10B0B00CE933D /* Sources */, + 55B6377818C10B0B00CE933D /* Frameworks */, + 55B6377918C10B0B00CE933D /* Headers */, + 55B6377A18C10B0B00CE933D /* Resources */, + 55F7E7C219D8C31300525388 /* Copy Tools */, + ); + buildRules = ( + ); + dependencies = ( + 55B637C318C10C5600CE933D /* PBXTargetDependency */, + ); + name = Pref360Control; + productName = Pref360Control; + productReference = 55B6377D18C10B0B00CE933D /* Pref360Control.prefPane */; + productType = "com.apple.product-type.bundle"; + }; + 55B637E718C10D5000CE933D /* Wireless360Controller */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B637F318C10D5000CE933D /* Build configuration list for PBXNativeTarget "Wireless360Controller" */; + buildPhases = ( + 55B637E218C10D5000CE933D /* Sources */, + 55B637E318C10D5000CE933D /* Frameworks */, + 55B637E418C10D5000CE933D /* Headers */, + 55B637E518C10D5000CE933D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Wireless360Controller; + productName = Wireless360Controller2; + productReference = 55B637E818C10D5000CE933D /* Wireless360Controller.kext */; + productType = "com.apple.product-type.kernel-extension"; + }; + 55B6380D18C10E8700CE933D /* WirelessGamingReceiver */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55B6381918C10E9500CE933D /* Build configuration list for PBXNativeTarget "WirelessGamingReceiver" */; + buildPhases = ( + 55B6380818C10E8700CE933D /* Sources */, + 55B6380918C10E8700CE933D /* Frameworks */, + 55B6380A18C10E8700CE933D /* Headers */, + 55B6380B18C10E8700CE933D /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = WirelessGamingReceiver; + productName = WirelessGamingReceiver2; + productReference = 55B6380E18C10E8700CE933D /* WirelessGamingReceiver.kext */; + productType = "com.apple.product-type.kernel-extension"; + }; + 55FE3CA018D7B77800D69E84 /* testhaptic */ = { + isa = PBXNativeTarget; + buildConfigurationList = 55FE3CAA18D7B77800D69E84 /* Build configuration list for PBXNativeTarget "testhaptic" */; + buildPhases = ( + 55FE3C9D18D7B77800D69E84 /* Sources */, + 55FE3C9E18D7B77800D69E84 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 55DA7C6D1926BED3002F6A3A /* PBXTargetDependency */, + ); + name = testhaptic; + productName = testhaptic; + productReference = 55FE3CA118D7B77800D69E84 /* testhaptic */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 55B636AC18C104DB00CE933D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = GitHub; + }; + buildConfigurationList = 55B636AF18C104DB00CE933D /* Build configuration list for PBXProject "360 Driver" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + English, + ); + mainGroup = 55B636AB18C104DB00CE933D; + productRefGroup = 55B636B518C104DB00CE933D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 55B6383818C10F8E00CE933D /* Whole Driver */, + 55B6375F18C10A3200CE933D /* DriverTool */, + 55B636B318C104DB00CE933D /* 360Daemon */, + 55B6371E18C108A500CE933D /* Feedback360 */, + 55B6377C18C10B0B00CE933D /* Pref360Control */, + 55B6370618C1057100CE933D /* 360Controller */, + 55B637E718C10D5000CE933D /* Wireless360Controller */, + 55B6380D18C10E8700CE933D /* WirelessGamingReceiver */, + 55FE3CA018D7B77800D69E84 /* testhaptic */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 55B636B218C104DB00CE933D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55699CD61971D96E00C40A31 /* Images.xcassets in Resources */, + 55B636C218C104DB00CE933D /* InfoPlist.strings in Resources */, + 55A2B8D818C116E0006829A2 /* Localizable.strings in Resources */, + 55B637D318C10CB400CE933D /* Alert.tif in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6370418C1057100CE933D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6371618C1058E00CE933D /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6371D18C108A500CE933D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6373D18C108D200CE933D /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6377A18C10B0B00CE933D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6378618C10B0B00CE933D /* InfoPlist.strings in Resources */, + 55699CD71971DA8100C40A31 /* Images.xcassets in Resources */, + 3F9B7C0A1A729C1600149949 /* artworks.xcassets in Resources */, + 55B637C018C10C2400CE933D /* pref360controlpref.tiff in Resources */, + 55852E1F18D6B5580009BF55 /* Localizable.strings in Resources */, + 551CDFF9196EEE76000869B6 /* Pref360ControlPref.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B637E518C10D5000CE933D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6380018C10DA300CE933D /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6380B18C10E8700CE933D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6382C18C10EBE00CE933D /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 55B636B018C104DB00CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B637D518C10CB400CE933D /* ControlPrefs.m in Sources */, + 55A2B8D518C116BD006829A2 /* 360Daemon.m in Sources */, + 55750C09190AFB5B0047FF41 /* DaemonLEDs.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6370118C1057100CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6371918C105B800CE933D /* chatpadkeys.cpp in Sources */, + 55B6371718C105B800CE933D /* _60Controller.cpp in Sources */, + 55B6371818C105B800CE933D /* ChatPad.cpp in Sources */, + 55B6371A18C105B800CE933D /* Controller.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6371B18C108A500CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6373E18C108D200CE933D /* Feedback360.cpp in Sources */, + 55B6373C18C108D200CE933D /* devlink.cpp in Sources */, + 55B6373F18C108D200CE933D /* Feedback360Effect.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6375C18C10A3200CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6377218C10A5400CE933D /* DriverTool.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6377718C10B0B00CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5B943BE21A83EC6600E77A79 /* MyAnalogStick.m in Sources */, + 55B637AD18C10C0C00CE933D /* DeviceLister.m in Sources */, + 3FE789A51A701FE200FF4065 /* MyWhole360Controller.m in Sources */, + 3FE789AD1A70288F00FF4065 /* MyDeadZoneViewer.m in Sources */, + 3FE789A11A701F3400FF4065 /* Pref360StyleKit.m in Sources */, + 55B637B918C10C0C00CE933D /* Pref360ControlPref.m in Sources */, + 3FE789A91A70281200FF4065 /* MyBatteryMonitor.m in Sources */, + 622A73CF1A7C879300784C02 /* BindingTableView.m in Sources */, + 55B637AB18C10C0C00CE933D /* DeviceItem.m in Sources */, + 55B637DD18C10CCC00CE933D /* ControlPrefs.m in Sources */, + 622A73C31A7C339000784C02 /* MyWhole360ControllerMapper.m in Sources */, + 3FE789B11A70331C00FF4065 /* MyTrigger.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B637E218C10D5000CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6380318C10DA300CE933D /* Wireless360Controller.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55B6380818C10E8700CE933D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55B6383318C10EBE00CE933D /* WirelessHIDDevice.cpp in Sources */, + 55B6382F18C10EBE00CE933D /* WirelessDevice.cpp in Sources */, + 55B6383118C10EBE00CE933D /* WirelessGamingReceiver.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 55FE3C9D18D7B77800D69E84 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 55FE3CAB18D7B78D00D69E84 /* testhaptic.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 55B6374E18C1097D00CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B6371E18C108A500CE933D /* Feedback360 */; + targetProxy = 55B6374D18C1097D00CE933D /* PBXContainerItemProxy */; + }; + 55B637C318C10C5600CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B6375F18C10A3200CE933D /* DriverTool */; + targetProxy = 55B637C218C10C5600CE933D /* PBXContainerItemProxy */; + }; + 55B6383D18C10FA200CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B636B318C104DB00CE933D /* 360Daemon */; + targetProxy = 55B6383C18C10FA200CE933D /* PBXContainerItemProxy */; + }; + 55B6383F18C10FA200CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B6370618C1057100CE933D /* 360Controller */; + targetProxy = 55B6383E18C10FA200CE933D /* PBXContainerItemProxy */; + }; + 55B6384118C10FA200CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B6377C18C10B0B00CE933D /* Pref360Control */; + targetProxy = 55B6384018C10FA200CE933D /* PBXContainerItemProxy */; + }; + 55B6384318C10FA200CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B637E718C10D5000CE933D /* Wireless360Controller */; + targetProxy = 55B6384218C10FA200CE933D /* PBXContainerItemProxy */; + }; + 55B6384518C10FA200CE933D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B6380D18C10E8700CE933D /* WirelessGamingReceiver */; + targetProxy = 55B6384418C10FA200CE933D /* PBXContainerItemProxy */; + }; + 55DA7C6D1926BED3002F6A3A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 55B6371E18C108A500CE933D /* Feedback360 */; + targetProxy = 55DA7C6C1926BED3002F6A3A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 551CDFFB196EEE76000869B6 /* Pref360ControlPref.xib */ = { + isa = PBXVariantGroup; + children = ( + 551B911F1A68BDB000EA6527 /* en */, + ); + name = Pref360ControlPref.xib; + sourceTree = ""; + }; + 55852E2118D6B5580009BF55 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 55852E2018D6B5580009BF55 /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 55A2B8DA18C116E0006829A2 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 55A2B8DB18C116E2006829A2 /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 55B636C018C104DB00CE933D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55B636C118C104DB00CE933D /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 55B636F918C1054F00CE933D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55B636FA18C1054F00CE933D /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 55B6372F18C108D200CE933D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55B6373018C108D200CE933D /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 55B6378418C10B0B00CE933D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55B6378518C10B0B00CE933D /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 55B637F718C10DA300CE933D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55B637F818C10DA300CE933D /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 55B6381E18C10EBE00CE933D /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 55B6381F18C10EBE00CE933D /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 55B636E318C104DB00CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1.0.0d15; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + STRIP_INSTALLED_PRODUCT = NO; + VERSIONING_SYSTEM = "apple-generic"; + WARNING_CFLAGS = ( + "-Wno-unknown-warning-option", + "-Wno-deprecated-register", + ); + }; + name = Debug; + }; + 55B636E418C104DB00CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "3rd Party Mac Developer Application"; + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + CURRENT_PROJECT_VERSION = 1.0.0d15; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + SDKROOT = macosx; + STRINGS_FILE_OUTPUT_ENCODING = binary; + VERSIONING_SYSTEM = "apple-generic"; + WARNING_CFLAGS = ( + "-Wno-unknown-warning-option", + "-Wno-deprecated-register", + ); + }; + name = Release; + }; + 55B636E618C104DB00CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = 360Control; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "360Daemon/360DaemonApp-Prefix.pch"; + INFOPLIST_FILE = "360Daemon/360DaemonApp-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Application Support/MICE"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 55B636E718C104DB00CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = 360Control; + DEAD_CODE_STRIPPING = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "360Daemon/360DaemonApp-Prefix.pch"; + INFOPLIST_FILE = "360Daemon/360DaemonApp-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Application Support/MICE"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 55B6371418C1057100CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CLANG_CXX_LANGUAGE_STANDARD[arch=i386]" = "compiler-default"; + INFOPLIST_FILE = 360Controller/Info.plist; + MODULE_NAME = com.mice.driver.Xbox360Controller; + MODULE_VERSION = "${CURRENT_PROJECT_VERSION}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = kext; + }; + name = Debug; + }; + 55B6371518C1057100CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CLANG_CXX_LANGUAGE_STANDARD[arch=i386]" = "compiler-default"; + INFOPLIST_FILE = 360Controller/Info.plist; + MODULE_NAME = com.mice.driver.Xbox360Controller; + MODULE_VERSION = "${CURRENT_PROJECT_VERSION}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = kext; + }; + name = Release; + }; + 55B6372A18C108A500CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + EXPORTED_SYMBOLS_FILE = Feedback360/Feedback360.exp; + INFOPLIST_FILE = Feedback360/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = plugin; + }; + name = Debug; + }; + 55B6372B18C108A500CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + DEAD_CODE_STRIPPING = YES; + EXPORTED_SYMBOLS_FILE = Feedback360/Feedback360.exp; + INFOPLIST_FILE = Feedback360/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + WRAPPER_EXTENSION = plugin; + }; + name = Release; + }; + 55B6376818C10A3200CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CREATE_INFOPLIST_SECTION_IN_BINARY = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = DriverTool/DriverTool_Prefix.pch; + INFOPLIST_FILE = DriverTool/Info.plist; + MACH_O_TYPE = mh_execute; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 55B6376918C10A3200CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CREATE_INFOPLIST_SECTION_IN_BINARY = YES; + DEAD_CODE_STRIPPING = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = DriverTool/DriverTool_Prefix.pch; + INFOPLIST_FILE = DriverTool/Info.plist; + MACH_O_TYPE = mh_execute; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + }; + name = Release; + }; + 55B6379118C10B0B00CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = 360Control; + DEPLOYMENT_LOCATION = NO; + DSTROOT = /; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Pref360Control/Pref360Control_Prefix.pch; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/360Daemon", + "$(inherited)", + ); + INFOPLIST_FILE = Pref360Control/Info.plist; + INSTALL_PATH = "${LOCAL_LIBRARY_DIR}/PreferencePanes"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = prefPane; + }; + name = Debug; + }; + 55B6379218C10B0B00CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = 360Control; + DEAD_CODE_STRIPPING = YES; + DEPLOYMENT_LOCATION = NO; + DSTROOT = /; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Pref360Control/Pref360Control_Prefix.pch; + HEADER_SEARCH_PATHS = ( + "$(SRCROOT)/360Daemon", + "$(inherited)", + ); + INFOPLIST_FILE = Pref360Control/Info.plist; + INSTALL_PATH = "${LOCAL_LIBRARY_DIR}/PreferencePanes"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = prefPane; + }; + name = Release; + }; + 55B637F418C10D5000CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CLANG_CXX_LANGUAGE_STANDARD[arch=i386]" = "compiler-default"; + INFOPLIST_FILE = Wireless360Controller/Info.plist; + MODULE_NAME = com.mice.driver.Wireless360Controller; + MODULE_VERSION = "${CURRENT_PROJECT_VERSION}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = kext; + }; + name = Debug; + }; + 55B637F518C10D5000CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CLANG_CXX_LANGUAGE_STANDARD[arch=i386]" = "compiler-default"; + INFOPLIST_FILE = Wireless360Controller/Info.plist; + MODULE_NAME = com.mice.driver.Wireless360Controller; + MODULE_VERSION = "${CURRENT_PROJECT_VERSION}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = kext; + }; + name = Release; + }; + 55B6381A18C10E9500CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CLANG_CXX_LANGUAGE_STANDARD[arch=i386]" = "compiler-default"; + INFOPLIST_FILE = WirelessGamingReceiver/Info.plist; + MODULE_NAME = com.mice.driver.WirelessGamingReceiver; + MODULE_VERSION = "${CURRENT_PROJECT_VERSION}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = kext; + }; + name = Debug; + }; + 55B6381B18C10E9500CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CLANG_CXX_LANGUAGE_STANDARD[arch=i386]" = "compiler-default"; + INFOPLIST_FILE = WirelessGamingReceiver/Info.plist; + MODULE_NAME = com.mice.driver.WirelessGamingReceiver; + MODULE_VERSION = "${CURRENT_PROJECT_VERSION}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = kext; + }; + name = Release; + }; + 55B6383A18C10F8E00CE933D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 55B6383B18C10F8E00CE933D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 55FE3CA818D7B77800D69E84 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + LD_RUNPATH_SEARCH_PATHS = /Library/Frameworks; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 55FE3CA918D7B77800D69E84 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(LOCAL_LIBRARY_DIR)/Frameworks", + ); + GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; + LD_RUNPATH_SEARCH_PATHS = /Library/Frameworks; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 55B636AF18C104DB00CE933D /* Build configuration list for PBXProject "360 Driver" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B636E318C104DB00CE933D /* Debug */, + 55B636E418C104DB00CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B636E518C104DB00CE933D /* Build configuration list for PBXNativeTarget "360Daemon" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B636E618C104DB00CE933D /* Debug */, + 55B636E718C104DB00CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B6371318C1057100CE933D /* Build configuration list for PBXNativeTarget "360Controller" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B6371418C1057100CE933D /* Debug */, + 55B6371518C1057100CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B6372918C108A500CE933D /* Build configuration list for PBXNativeTarget "Feedback360" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B6372A18C108A500CE933D /* Debug */, + 55B6372B18C108A500CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B6376718C10A3200CE933D /* Build configuration list for PBXNativeTarget "DriverTool" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B6376818C10A3200CE933D /* Debug */, + 55B6376918C10A3200CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B6379018C10B0B00CE933D /* Build configuration list for PBXNativeTarget "Pref360Control" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B6379118C10B0B00CE933D /* Debug */, + 55B6379218C10B0B00CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B637F318C10D5000CE933D /* Build configuration list for PBXNativeTarget "Wireless360Controller" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B637F418C10D5000CE933D /* Debug */, + 55B637F518C10D5000CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B6381918C10E9500CE933D /* Build configuration list for PBXNativeTarget "WirelessGamingReceiver" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B6381A18C10E9500CE933D /* Debug */, + 55B6381B18C10E9500CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55B6383918C10F8E00CE933D /* Build configuration list for PBXAggregateTarget "Whole Driver" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55B6383A18C10F8E00CE933D /* Debug */, + 55B6383B18C10F8E00CE933D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 55FE3CAA18D7B77800D69E84 /* Build configuration list for PBXNativeTarget "testhaptic" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 55FE3CA818D7B77800D69E84 /* Debug */, + 55FE3CA918D7B77800D69E84 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 55B636AC18C104DB00CE933D /* Project object */; +} diff --git a/360 Driver.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/360 Driver.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..5a85863 --- /dev/null +++ b/360 Driver.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/360Controller/360Controller.xcodeproj/project.pbxproj b/360Controller/360Controller.xcodeproj/project.pbxproj deleted file mode 100644 index 04a14ef..0000000 --- a/360Controller/360Controller.xcodeproj/project.pbxproj +++ /dev/null @@ -1,390 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 32D94FC60562CBF700B6AF17 /* _60Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A224C3EFF42367911CA2CB7 /* _60Controller.h */; }; - 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; - 32D94FCA0562CBF700B6AF17 /* _60Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A224C3FFF42367911CA2CB7 /* _60Controller.cpp */; settings = {ATTRIBUTES = (); }; }; - 3B36DCC410B7816F00FFD769 /* Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B36DCC210B7816F00FFD769 /* Controller.cpp */; }; - 3B36DCC510B7816F00FFD769 /* Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B36DCC310B7816F00FFD769 /* Controller.h */; }; - 3B36DCCB10B7817E00FFD769 /* ChatPad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B36DCC610B7817E00FFD769 /* ChatPad.cpp */; }; - 3B36DCCC10B7817E00FFD769 /* ChatPad.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B36DCC710B7817E00FFD769 /* ChatPad.h */; }; - 3B36DCCD10B7817E00FFD769 /* chatpadhid.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B36DCC810B7817E00FFD769 /* chatpadhid.h */; }; - 3B36DCCE10B7817E00FFD769 /* chatpadkeys.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B36DCC910B7817E00FFD769 /* chatpadkeys.cpp */; }; - 3B36DCCF10B7817E00FFD769 /* chatpadkeys.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B36DCCA10B7817E00FFD769 /* chatpadkeys.h */; }; - 3BB5E09C09641F8200F83598 /* xbox360hid.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB5E09B09641F8200F83598 /* xbox360hid.h */; }; - 3BCE45CA09638EBC00B69EDF /* ControlStruct.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BCE45C909638EBC00B69EDF /* ControlStruct.h */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 1A224C3EFF42367911CA2CB7 /* _60Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _60Controller.h; sourceTree = ""; }; - 1A224C3FFF42367911CA2CB7 /* _60Controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = _60Controller.cpp; sourceTree = ""; }; - 32D94FCF0562CBF700B6AF17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 32D94FD00562CBF700B6AF17 /* 360Controller.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = 360Controller.kext; sourceTree = BUILT_PRODUCTS_DIR; }; - 3B0F1276097B395B00127827 /* Feedback360.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = Feedback360.bundle; path = ../Feedback360/build/Deployment/Feedback360.bundle; sourceTree = SOURCE_ROOT; }; - 3B36DCC210B7816F00FFD769 /* Controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Controller.cpp; sourceTree = ""; }; - 3B36DCC310B7816F00FFD769 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = ""; }; - 3B36DCC610B7817E00FFD769 /* ChatPad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ChatPad.cpp; sourceTree = ""; }; - 3B36DCC710B7817E00FFD769 /* ChatPad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatPad.h; sourceTree = ""; }; - 3B36DCC810B7817E00FFD769 /* chatpadhid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chatpadhid.h; sourceTree = ""; }; - 3B36DCC910B7817E00FFD769 /* chatpadkeys.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = chatpadkeys.cpp; sourceTree = ""; }; - 3B36DCCA10B7817E00FFD769 /* chatpadkeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chatpadkeys.h; sourceTree = ""; }; - 3BB5E09B09641F8200F83598 /* xbox360hid.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = xbox360hid.h; sourceTree = ""; }; - 3BCE45C909638EBC00B69EDF /* ControlStruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlStruct.h; sourceTree = ""; }; - 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 32D94FCB0562CBF700B6AF17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* 360Controller */ = { - isa = PBXGroup; - children = ( - 247142CAFF3F8F9811CA285C /* Source */, - 089C167CFE841241C02AAC07 /* Resources */, - 19C28FB6FE9D52B211CA2CBB /* Products */, - ); - name = 360Controller; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 3B2EF52A0965A0AE007BFB7B /* Kernel Driver */, - ); - name = Resources; - sourceTree = ""; - }; - 19C28FB6FE9D52B211CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 32D94FD00562CBF700B6AF17 /* 360Controller.kext */, - ); - name = Products; - sourceTree = ""; - }; - 247142CAFF3F8F9811CA285C /* Source */ = { - isa = PBXGroup; - children = ( - 3B2EF19A0965A03E007BFB7B /* Kernel Driver */, - ); - name = Source; - sourceTree = ""; - }; - 3B2EF19A0965A03E007BFB7B /* Kernel Driver */ = { - isa = PBXGroup; - children = ( - 3B36DCC010B7815000FFD769 /* Controller */, - 3B36DCC110B7815700FFD769 /* ChatPad */, - 3BCE45C909638EBC00B69EDF /* ControlStruct.h */, - 1A224C3EFF42367911CA2CB7 /* _60Controller.h */, - 1A224C3FFF42367911CA2CB7 /* _60Controller.cpp */, - ); - name = "Kernel Driver"; - sourceTree = ""; - }; - 3B2EF52A0965A0AE007BFB7B /* Kernel Driver */ = { - isa = PBXGroup; - children = ( - 3B0F1276097B395B00127827 /* Feedback360.bundle */, - 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */, - 32D94FCF0562CBF700B6AF17 /* Info.plist */, - 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - ); - name = "Kernel Driver"; - sourceTree = ""; - }; - 3B36DCC010B7815000FFD769 /* Controller */ = { - isa = PBXGroup; - children = ( - 3B36DCC210B7816F00FFD769 /* Controller.cpp */, - 3B36DCC310B7816F00FFD769 /* Controller.h */, - 3BB5E09B09641F8200F83598 /* xbox360hid.h */, - ); - name = Controller; - sourceTree = ""; - }; - 3B36DCC110B7815700FFD769 /* ChatPad */ = { - isa = PBXGroup; - children = ( - 3B36DCC610B7817E00FFD769 /* ChatPad.cpp */, - 3B36DCC710B7817E00FFD769 /* ChatPad.h */, - 3B36DCC910B7817E00FFD769 /* chatpadkeys.cpp */, - 3B36DCCA10B7817E00FFD769 /* chatpadkeys.h */, - 3B36DCC810B7817E00FFD769 /* chatpadhid.h */, - ); - name = ChatPad; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 32D94FC50562CBF700B6AF17 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FC60562CBF700B6AF17 /* _60Controller.h in Headers */, - 3BCE45CA09638EBC00B69EDF /* ControlStruct.h in Headers */, - 3BB5E09C09641F8200F83598 /* xbox360hid.h in Headers */, - 3B36DCC510B7816F00FFD769 /* Controller.h in Headers */, - 3B36DCCC10B7817E00FFD769 /* ChatPad.h in Headers */, - 3B36DCCD10B7817E00FFD769 /* chatpadhid.h in Headers */, - 3B36DCCF10B7817E00FFD769 /* chatpadkeys.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 32D94FC30562CBF700B6AF17 /* 360Controller */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3BBDC682097938A90023AAD8 /* Build configuration list for PBXNativeTarget "360Controller" */; - buildPhases = ( - 32D94FC50562CBF700B6AF17 /* Headers */, - 32D94FC70562CBF700B6AF17 /* Resources */, - 32D94FC90562CBF700B6AF17 /* Sources */, - 32D94FCB0562CBF700B6AF17 /* Frameworks */, - 32D94FCC0562CBF700B6AF17 /* Rez */, - 3B0F12A1097B3A3A00127827 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = 360Controller; - productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - productName = 360Controller; - productReference = 32D94FD00562CBF700B6AF17 /* 360Controller.kext */; - productType = "com.apple.product-type.kernel-extension.iokit"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 3BBDC686097938A90023AAD8 /* Build configuration list for PBXProject "360Controller" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 089C166AFE841209C02AAC07 /* 360Controller */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 32D94FC30562CBF700B6AF17 /* 360Controller */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 32D94FC70562CBF700B6AF17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 32D94FCC0562CBF700B6AF17 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - 3B0F12A1097B3A3A00127827 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "cd \"$TARGET_BUILD_DIR/$TARGET_NAME.kext/Contents\"\nmkdir PlugIns > /dev/null 2>&1\nrm -R PlugIns/Feedback360.plugin > /dev/null 2>&1\necho \"$SRCROOT/../Feedback360/build/Deployment/Feedback360.bundle\"\ncp -R \"$SRCROOT/../Feedback360/build/Deployment/Feedback360.bundle\" PlugIns/Feedback360.plugin\n# Renaming extension from bundle to a plugin? Could be naughty."; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 32D94FC90562CBF700B6AF17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FCA0562CBF700B6AF17 /* _60Controller.cpp in Sources */, - 3B36DCC410B7816F00FFD769 /* Controller.cpp in Sources */, - 3B36DCCB10B7817E00FFD769 /* ChatPad.cpp in Sources */, - 3B36DCCE10B7817E00FFD769 /* chatpadkeys.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 3BBDC683097938A90023AAD8 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = com.mice.driver.Xbox360Controller; - MODULE_VERSION = 1.0.0d11; - PREBINDING = NO; - PRODUCT_NAME = 360Controller; - SDKROOT = ""; - WRAPPER_EXTENSION = kext; - ZERO_LINK = YES; - }; - name = Development; - }; - 3BBDC684097938A90023AAD8 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - ppc, - i386, - x86_64, - ); - COPY_PHASE_STRIP = YES; - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - LD_GENERATE_MAP_FILE = NO; - MODULE_NAME = com.mice.driver.Xbox360Controller; - MODULE_VERSION = 1.0.0d11; - PREBINDING = NO; - PRODUCT_NAME = 360Controller; - WRAPPER_EXTENSION = kext; - ZERO_LINK = NO; - }; - name = Deployment; - }; - 3BBDC685097938A90023AAD8 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = com.mice.driver.Xbox360Controller; - MODULE_VERSION = 1.0.0d11; - PREBINDING = NO; - PRODUCT_NAME = 360Controller; - WRAPPER_EXTENSION = kext; - }; - name = Default; - }; - 3BBDC687097938A90023AAD8 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Development; - }; - 3BBDC688097938A90023AAD8 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_VERSION = ""; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - "SDKROOT[arch=x86_64]" = ""; - }; - name = Deployment; - }; - 3BBDC689097938A90023AAD8 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3BBDC682097938A90023AAD8 /* Build configuration list for PBXNativeTarget "360Controller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3BBDC683097938A90023AAD8 /* Development */, - 3BBDC684097938A90023AAD8 /* Deployment */, - 3BBDC685097938A90023AAD8 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 3BBDC686097938A90023AAD8 /* Build configuration list for PBXProject "360Controller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3BBDC687097938A90023AAD8 /* Development */, - 3BBDC688097938A90023AAD8 /* Deployment */, - 3BBDC689097938A90023AAD8 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/360Controller/ControlStruct.h b/360Controller/ControlStruct.h index 80c5a65..6fe8e72 100644 --- a/360Controller/ControlStruct.h +++ b/360Controller/ControlStruct.h @@ -32,18 +32,18 @@ typedef SInt16 XBox360_SShort; #define PACKED __attribute__((__packed__)) // Common structure format -typedef struct { +typedef struct XBOX360_PACKET { XBox360_Byte command; XBox360_Byte size; } PACKED XBOX360_PACKET; // Analog stick format -typedef struct { +typedef struct XBOX360_HAT { XBox360_SShort x,y; } PACKED XBOX360_HAT; // Structure describing the report had back from the controller -typedef struct { +typedef struct XBOX360_IN_REPORT { XBOX360_PACKET header; XBox360_Short buttons; XBox360_Byte trigL,trigR; @@ -52,13 +52,13 @@ typedef struct { } PACKED XBOX360_IN_REPORT; // Structure describing the command to change LED status -typedef struct { +typedef struct XBOX360_OUT_LED { XBOX360_PACKET header; XBox360_Byte pattern; } PACKED XBOX360_OUT_LED; // Structure describing the command to change rumble motor status -typedef struct { +typedef struct XBOX360_OUT_RUMBLE { XBOX360_PACKET header; XBox360_Byte reserved1; XBox360_Byte big,little; @@ -66,7 +66,7 @@ typedef struct { } PACKED XBOX360_OUT_RUMBLE; // Enumeration of command types -enum { +enum CommandTypes { // In inReport = 0, // Out @@ -75,7 +75,7 @@ enum { }; // Button bits -enum { +enum ButtonBits { btnHatRight = 0x8000, btnHatLeft = 0x4000, btnBack = 0x2000, @@ -95,7 +95,7 @@ enum { }; // LED values -enum { +enum LEDValues { ledOff = 0x00, ledBlinkingAll = 0x01, ledFlashOn1 = 0x02, diff --git a/360Controller/Controller.cpp b/360Controller/Controller.cpp index 7bc3903..3a315e8 100644 --- a/360Controller/Controller.cpp +++ b/360Controller/Controller.cpp @@ -34,9 +34,8 @@ OSDefineMetaClassAndStructors(Xbox360ControllerClass, IOHIDDevice) static Xbox360Peripheral* GetOwner(IOService *us) { - IOService *prov; - - prov = us->getProvider(); + IOService *prov = us->getProvider(); + if (prov == NULL) return NULL; return OSDynamicCast(Xbox360Peripheral, prov); @@ -44,9 +43,8 @@ static Xbox360Peripheral* GetOwner(IOService *us) static IOUSBDevice* GetOwnerProvider(const IOService *us) { - IOService *prov, *provprov; + IOService *prov = us->getProvider(), *provprov; - prov = us->getProvider(); if (prov == NULL) return NULL; provprov = prov->getProvider(); @@ -73,10 +71,9 @@ IOReturn Xbox360ControllerClass::setProperties(OSObject *properties) // Returns the HID descriptor for this device IOReturn Xbox360ControllerClass::newReportDescriptor(IOMemoryDescriptor **descriptor) const { - IOBufferMemoryDescriptor *buffer; + IOBufferMemoryDescriptor *buffer = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task,0,sizeof(HID_360::ReportDescriptor)); - buffer=IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task,0,sizeof(HID_360::ReportDescriptor)); - if(buffer==NULL) return kIOReturnNoResources; + if (buffer == NULL) return kIOReturnNoResources; buffer->writeBytes(0,HID_360::ReportDescriptor,sizeof(HID_360::ReportDescriptor)); *descriptor=buffer; return kIOReturnSuccess; @@ -87,10 +84,12 @@ IOReturn Xbox360ControllerClass::setReport(IOMemoryDescriptor *report,IOHIDRepor { char data[2]; - report->readBytes(0,data,2); + report->readBytes(0, data, 2); + if (GetOwner(this)->rumbleType == 1) // Don't Rumble + return kIOReturnSuccess; switch(data[0]) { case 0x00: // Set force feedback - if((data[1]!=report->getLength())||(data[1]!=0x04)) return kIOReturnUnsupported; + if((data[1]!=report->getLength()) || (data[1]!=0x04)) return kIOReturnUnsupported; { XBOX360_OUT_RUMBLE rumble; @@ -99,7 +98,7 @@ IOReturn Xbox360ControllerClass::setReport(IOMemoryDescriptor *report,IOHIDRepor rumble.big=data[0]; rumble.little=data[1]; GetOwner(this)->QueueWrite(&rumble,sizeof(rumble)); -// IOLog("Set rumble: big(%d) little(%d)\n", rumble.big, rumble.little); + // IOLog("Set rumble: big(%d) little(%d)\n", rumble.big, rumble.little); } return kIOReturnSuccess; case 0x01: // Set LEDs @@ -111,7 +110,7 @@ IOReturn Xbox360ControllerClass::setReport(IOMemoryDescriptor *report,IOHIDRepor Xbox360_Prepare(led,outLed); led.pattern=data[0]; GetOwner(this)->QueueWrite(&led,sizeof(led)); -// IOLog("Set LED: %d\n", led.pattern); + // IOLog("Set LED: %d\n", led.pattern); } return kIOReturnSuccess; default: @@ -127,6 +126,22 @@ IOReturn Xbox360ControllerClass::getReport(IOMemoryDescriptor *report,IOHIDRepor return kIOReturnUnsupported; } +IOReturn Xbox360ControllerClass::handleReport(IOMemoryDescriptor * descriptor, IOHIDReportType reportType, IOOptionBits options) { + if (descriptor->getLength() >= sizeof(XBOX360_IN_REPORT)) { + IOBufferMemoryDescriptor *desc = OSDynamicCast(IOBufferMemoryDescriptor, descriptor); + if (desc != NULL) { + XBOX360_IN_REPORT *report=(XBOX360_IN_REPORT*)desc->getBytesNoCopy(); + if ((report->header.command==inReport) && (report->header.size==sizeof(XBOX360_IN_REPORT))) { + GetOwner(this)->fiddleReport(desc); + remapButtons(report); + } + } + } + IOReturn ret = IOHIDDevice::handleReport(descriptor, reportType, options); + return ret; +} + + // Returns the string for the specified index from the USB device's string list, with an optional default OSString* Xbox360ControllerClass::getDeviceString(UInt8 index,const char *def) const { @@ -134,11 +149,11 @@ OSString* Xbox360ControllerClass::getDeviceString(UInt8 index,const char *def) c char buf[1024]; const char *string; - err = GetOwnerProvider(this)->GetStringDescriptor(index,buf,sizeof(buf)); + err = GetOwnerProvider(this)->GetStringDescriptor(index, buf, sizeof(buf)); if(err==kIOReturnSuccess) string=buf; else { - if(def==NULL) string="Unknown"; - else string=def; + if(def == NULL) string = "Unknown"; + else string = def; } return OSString::withCString(string); } @@ -165,7 +180,7 @@ OSNumber* Xbox360ControllerClass::newProductIDNumber() const OSString* Xbox360ControllerClass::newProductString() const { - return getDeviceString(GetOwnerProvider(this)->GetProductStringIndex()); + return OSString::withCString("Xbox 360 Wired Controller"); } OSString* Xbox360ControllerClass::newSerialNumberString() const @@ -187,7 +202,7 @@ OSNumber* Xbox360ControllerClass::newLocationIDNumber() const { IOUSBDevice *device; OSNumber *number; - UInt32 location; + UInt32 location = 0; device = GetOwnerProvider(this); if (device) @@ -209,3 +224,374 @@ OSNumber* Xbox360ControllerClass::newLocationIDNumber() const return (location != 0) ? OSNumber::withNumber(location, 32) : 0; } + +void Xbox360ControllerClass::remapButtons(void *buffer) +{ + XBOX360_IN_REPORT *report360 = (XBOX360_IN_REPORT*)buffer; + UInt16 new_buttons = 0; + + new_buttons |= ((report360->buttons & 1) == 1) << GetOwner(this)->mapping[0]; + new_buttons |= ((report360->buttons & 2) == 2) << GetOwner(this)->mapping[1]; + new_buttons |= ((report360->buttons & 4) == 4) << GetOwner(this)->mapping[2]; + new_buttons |= ((report360->buttons & 8) == 8) << GetOwner(this)->mapping[3]; + new_buttons |= ((report360->buttons & 16) == 16) << GetOwner(this)->mapping[4]; + new_buttons |= ((report360->buttons & 32) == 32) << GetOwner(this)->mapping[5]; + new_buttons |= ((report360->buttons & 64) == 64) << GetOwner(this)->mapping[6]; + new_buttons |= ((report360->buttons & 128) == 128) << GetOwner(this)->mapping[7]; + new_buttons |= ((report360->buttons & 256) == 256) << GetOwner(this)->mapping[8]; + new_buttons |= ((report360->buttons & 512) == 512) << GetOwner(this)->mapping[9]; + new_buttons |= ((report360->buttons & 1024) == 1024) << GetOwner(this)->mapping[10]; + new_buttons |= ((report360->buttons & 4096) == 4096) << GetOwner(this)->mapping[11]; + new_buttons |= ((report360->buttons & 8192) == 8192) << GetOwner(this)->mapping[12]; + new_buttons |= ((report360->buttons & 16384) == 16384) << GetOwner(this)->mapping[13]; + new_buttons |= ((report360->buttons & 32768) == 32768) << GetOwner(this)->mapping[14]; + +// IOLog("BUTTON PACKET - %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", GetOwner(this)->mapping[0], GetOwner(this)->mapping[1], GetOwner(this)->mapping[2], GetOwner(this)->mapping[3], GetOwner(this)->mapping[4], GetOwner(this)->mapping[5], GetOwner(this)->mapping[6], GetOwner(this)->mapping[7], GetOwner(this)->mapping[8], GetOwner(this)->mapping[9], GetOwner(this)->mapping[10], GetOwner(this)->mapping[11], GetOwner(this)->mapping[12], GetOwner(this)->mapping[13], GetOwner(this)->mapping[14]); + + report360->buttons = new_buttons; +} + + +/* + * Xbox original controller. + * Convert reports to Xbox 360 controller format and fake product ids + */ + +typedef struct { + XBOX360_PACKET header; + XBox360_Byte buttons; + XBox360_Byte reserved1; + XBox360_Byte a, b, x, y, black, white; + XBox360_Byte trigL,trigR; + XBox360_Short xL,yL; + XBox360_Short xR,yR; +} PACKED XBOX_IN_REPORT; + +typedef struct { + XBOX360_PACKET header; + XBox360_Byte reserved1; + XBox360_Byte left; + XBox360_Byte reserved2; + XBox360_Byte right; +} PACKED XBOX_OUT_RUMBLE; + + +OSDefineMetaClassAndStructors(XboxOriginalControllerClass, Xbox360ControllerClass) + +OSNumber* XboxOriginalControllerClass::newVendorIDNumber() const +{ + return OSNumber::withNumber(1118,16); +} + +OSString* XboxOriginalControllerClass::newManufacturerString() const +{ + return OSString::withCString("Holtek"); +} + +OSNumber* XboxOriginalControllerClass::newProductIDNumber() const +{ + return OSNumber::withNumber(654,16); +} + +OSString* XboxOriginalControllerClass::newProductString() const +{ + return OSString::withCString("Xbox Original Wired Controller"); +} + +static void logData(UInt8 *data, int len) { + for (int i = 0; i < len; i++) IOLog("%02x ", (int)data[i]); + IOLog("\n"); +} + +// This converts XBox original controller report into XBox360 form +// See https://github.com/Grumbel/xboxdrv/blob/master/src/controller/xbox_controller.cpp +static void convertFromXBoxOriginal(UInt8 *data) { + if (data[0] != 0x00 || data[1] != 0x14) { + IOLog("Unknown report command %d, length %d\n", (int)data[0], (int)data[1]); + return; + } + XBOX360_IN_REPORT report; + Xbox360_Prepare (report, 0); + XBOX_IN_REPORT *in = (XBOX_IN_REPORT*)data; + XBox360_Short buttons = in->buttons; + if (in->a) buttons |= 1 << 12; // a + if (in->b) buttons |= 1 << 13; // b + if (in->x) buttons |= 1 << 14; // x + if (in->y) buttons |= 1 << 15; // y + if (in->black) buttons |= 1 << 9; // black mapped to shoulder right + if (in->white) buttons |= 1 << 8; // white mapped to shoulder left + report.buttons = buttons; + report.trigL = in->trigL; + report.trigR = in->trigR; + report.left.x = in->xL; + report.left.y = in->yL; + report.right.x = in->xR; + report.right.y = in->yR; + *((XBOX360_IN_REPORT *)data) = report; +} + +IOReturn XboxOriginalControllerClass::handleReport(IOMemoryDescriptor * descriptor, IOHIDReportType reportType, IOOptionBits options) { +// IOLog("%s\n", __FUNCTION__); + UInt8 data[sizeof(XBOX360_IN_REPORT)]; + if (descriptor->getLength() >= sizeof(XBOX360_IN_REPORT)) { + descriptor->readBytes(0, data, sizeof(XBOX360_IN_REPORT)); + const XBOX360_IN_REPORT *report=(const XBOX360_IN_REPORT*)data; + if ((report->header.command==inReport) && (report->header.size==sizeof(XBOX360_IN_REPORT))) { + convertFromXBoxOriginal(data); + if (memcmp(data, lastData, sizeof(XBOX360_IN_REPORT)) == 0) { + repeatCount ++; + // drop triplicate reports + if (repeatCount > 1) { + return kIOReturnSuccess; + } + } else { + repeatCount = 0; + } + memcpy(lastData, data, sizeof(XBOX360_IN_REPORT)); + descriptor->writeBytes(0, data, sizeof(XBOX360_IN_REPORT)); + //if (data[2]&1) { + // IOLog("%s after %d ", __FUNCTION__, (int)reportType); + // logData(data, 20); + //} + } else { + IOLog("%s %d \n", __FUNCTION__, (int)descriptor->getLength()); + IOLog("%s %d \n", __FUNCTION__, (int)reportType); + logData(data, (int)descriptor->getLength()); + } + + } else { + descriptor->readBytes(0, data, descriptor->getLength()); + if (reportType != 0 && data[0] != 0) { + // not a rumble report + IOLog("%s %d \n", __FUNCTION__, (int)reportType); + logData(data, (int)descriptor->getLength()); + } + } + + IOReturn ret = Xbox360ControllerClass::handleReport(descriptor, reportType, options); + //IOLog("%s END\n", __FUNCTION__); + return ret; +} + +IOReturn XboxOriginalControllerClass::setReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options) +{ + char data[2]; + + report->readBytes(0, data, 2); + if (GetOwner(this)->rumbleType == 1) // Don't Rumble + return kIOReturnSuccess; + switch(data[0]) { + case 0x00: // Set force feedback + if((data[1]!=report->getLength()) || (data[1]!=0x04)) return kIOReturnUnsupported; + { + XBOX_OUT_RUMBLE rumble; + Xbox360_Prepare(rumble,outRumble); + report->readBytes(2,data,2); + rumble.left=data[0]; // CHECKME != big, little + rumble.right=data[1]; + GetOwner(this)->QueueWrite(&rumble,sizeof(rumble)); + // IOLog("Set rumble: big(%d) little(%d)\n", rumble.big, rumble.little); + } + return kIOReturnSuccess; + case 0x01: // Set LEDs + if((data[1]!=report->getLength())||(data[1]!=0x03)) return kIOReturnUnsupported; + // No leds + return kIOReturnSuccess; + + default: + IOLog("Unknown escape %d\n", data[0]); + return kIOReturnUnsupported; + } +} + +/* + * Xbox One controller. + * Convert reports to Xbox 360 controller format and fake product ids + */ + +typedef struct { + UInt8 command; + UInt8 reserved1; + UInt8 counter; + UInt8 size; +} PACKED XBOXONE_HEADER; + +typedef struct { + XBOXONE_HEADER header; + UInt16 buttons; + UInt16 trigL, trigR; + XBOX360_HAT left, right; +} PACKED XBOXONE_IN_REPORT; + +typedef struct { + XBOXONE_HEADER header; + UInt8 state; + UInt8 dummy; +} PACKED XBOXONE_IN_GUIDE_REPORT; + +typedef struct { + UInt8 command; // 0x09 + UInt8 reserved1; // So far 0x08 + UInt8 reserved2; // So far always 0x00 + UInt8 substructure; // 0x08 - Continuous, 0x09 - Single + UInt8 mode; // So far always 0x00 + UInt8 rumbleMask; // So far always 0x0F + UInt8 trigL, trigR; + UInt8 little, big; + UInt8 length; // Length of time to rumble + UInt8 period; // Period of time between pulses. DO NOT INCLUDE WHEN SUBSTRUCTURE IS 0x09 +} PACKED XBOXONE_OUT_RUMBLE; + +OSDefineMetaClassAndStructors(XboxOneControllerClass, Xbox360ControllerClass) + +OSNumber* XboxOneControllerClass::newVendorIDNumber() const +{ + return OSNumber::withNumber(1118,16); +} + +OSString* XboxOneControllerClass::newManufacturerString() const +{ + return OSString::withCString("Microsoft"); +} + +OSNumber* XboxOneControllerClass::newProductIDNumber() const +{ + return OSNumber::withNumber(654,16); +} + +OSString* XboxOneControllerClass::newProductString() const +{ + return OSString::withCString("Xbox One Wired Controller"); +} + +// This converts Xbox One controller report into Xbox360 form +void XboxOneControllerClass::convertFromXboxOne(void *buffer, void* override) { + +// if (data[0] != 0x00 || data[1] != 0x14) { +// IOLog("Unknown report command %d, length %d\n", (int)data[0], (int)data[1]); +// return; +// } + + XBOX360_IN_REPORT *report360 = (XBOX360_IN_REPORT*)buffer; + UInt8 trigL = 0, trigR = 0; + UInt16 new_buttons = 0; + XBOX360_HAT left, right; + + if (override == NULL) { + XBOXONE_IN_REPORT *reportXone = (XBOXONE_IN_REPORT*)buffer; + report360->header.command = reportXone->header.command - 0x20; // Change 0x20 into 0x00 + report360->header.size = reportXone->header.size + 0x06; // Change 0x0E into 0x14 + + new_buttons |= ((reportXone->buttons & 4) == 4) << 4; + new_buttons |= ((reportXone->buttons & 8) == 8) << 5; + new_buttons |= ((reportXone->buttons & 16) == 16) << 12; + new_buttons |= ((reportXone->buttons & 32) == 32) << 13; + new_buttons |= ((reportXone->buttons & 64) == 64) << 14; + new_buttons |= ((reportXone->buttons & 128) == 128) << 15; + new_buttons |= ((reportXone->buttons & 256) == 256) << 0; + new_buttons |= ((reportXone->buttons & 512) == 512) << 1; + new_buttons |= ((reportXone->buttons & 1024) == 1024) << 2; + new_buttons |= ((reportXone->buttons & 2048) == 2048) << 3; + new_buttons |= ((reportXone->buttons & 4096) == 4096) << 8; + new_buttons |= ((reportXone->buttons & 8192) == 8192) << 9; + new_buttons |= ((reportXone->buttons & 16384) == 16384) << 6; + new_buttons |= ((reportXone->buttons & 32768) == 32768) << 7; + new_buttons |= (isXboxOneGuideButtonPressed) << 10; + trigL = (reportXone->trigL / 1023.0) * 255; + trigR = (reportXone->trigR / 1023.0) * 255; + left = reportXone->left; + right = reportXone->right; + + report360->buttons = new_buttons; + report360->trigL = trigL; + report360->trigR = trigR; + report360->left = left; + report360->right = right; + } else { + XBOX360_IN_REPORT *reportOverride = (XBOX360_IN_REPORT*)override; + report360->header = reportOverride->header; + report360->buttons = reportOverride->buttons; + report360->buttons |= (isXboxOneGuideButtonPressed) << 10; + report360->trigL = reportOverride->trigL; + report360->trigR = reportOverride->trigR; + report360->left = reportOverride->left; + report360->right = reportOverride->right; + } +} + +IOReturn XboxOneControllerClass::handleReport(IOMemoryDescriptor * descriptor, IOHIDReportType reportType, IOOptionBits options) { + UInt8 data[sizeof(XBOXONE_IN_REPORT)]; + descriptor->readBytes(0, data, sizeof(XBOXONE_IN_REPORT)); + const XBOXONE_IN_REPORT *report=(const XBOXONE_IN_REPORT*)data; + if ((report->header.command==0x20) && report->header.size==(sizeof(XBOXONE_IN_REPORT)-4)) { + convertFromXboxOne(data, NULL); + memcpy(lastData, data, sizeof(XBOX360_IN_REPORT)); + descriptor->writeBytes(0, data, sizeof(XBOX360_IN_REPORT)); + } + else if (report->header.command==0x07 && report->header.size==(sizeof(XBOXONE_IN_GUIDE_REPORT)-4)) + { + const XBOXONE_IN_GUIDE_REPORT *guideReport=(const XBOXONE_IN_GUIDE_REPORT*)report; + isXboxOneGuideButtonPressed = (bool)guideReport->state; + convertFromXboxOne(data, lastData); + descriptor->writeBytes(0, data, sizeof(XBOX360_IN_REPORT)); + } + + IOReturn ret = Xbox360ControllerClass::handleReport(descriptor, reportType, options); + return ret; +} + +IOReturn XboxOneControllerClass::setReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options) +{ +// IOLog("Xbox One Controller - setReport\n"); + unsigned char data[4]; + report->readBytes(0, &data, 4); +// IOLog("Attempting to send: %d %d %d %d\n",((unsigned char*)data)[0], ((unsigned char*)data)[1], ((unsigned char*)data)[2], ((unsigned char*)data)[3]); + UInt8 rumbleType; + switch(data[0])//(header.command) + { + case 0x00: // Set force feedback + XBOXONE_OUT_RUMBLE rumble; + rumble.command = 0x09; + rumble.reserved1 = 0x08; + rumble.reserved2 = 0x00; + rumble.substructure = 0x09; + rumble.mode = 0x00; + rumble.rumbleMask = 0x0F; + rumble.length = 0x80; + + rumbleType = GetOwner(this)->rumbleType; + if (rumbleType == 0) // Default + { + rumble.trigL = 0x00; + rumble.trigR = 0x00; + rumble.little = data[2]; + rumble.big = data[3]; + } + else if (rumbleType == 1) // None + { + return kIOReturnSuccess; + } + else if (rumbleType == 2) // Trigger + { + rumble.trigL = data[2] / 2.0; + rumble.trigR = data[3] / 2.0; + rumble.little = 0x00; + rumble.big = 0x00; + } + else if (rumbleType == 3) // Both + { + rumble.trigL = data[2] / 2.0; + rumble.trigR = data[3] / 2.0; + rumble.little = data[2]; + rumble.big = data[3]; + } + + GetOwner(this)->QueueWrite(&rumble,11); + return kIOReturnSuccess; + case 0x01: // Unsupported LED + return kIOReturnSuccess; + default: + IOLog("Unknown escape %d\n", data[0]); + return kIOReturnUnsupported; + } +} diff --git a/360Controller/Controller.h b/360Controller/Controller.h index 0ac4321..c6847e7 100644 --- a/360Controller/Controller.h +++ b/360Controller/Controller.h @@ -39,6 +39,10 @@ class Xbox360ControllerClass : public IOHIDDevice virtual IOReturn setReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options=0); virtual IOReturn getReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options); + virtual IOReturn handleReport( + IOMemoryDescriptor * report, + IOHIDReportType reportType = kIOHIDReportTypeInput, + IOOptionBits options = 0 ); virtual OSString* newManufacturerString() const; virtual OSNumber* newPrimaryUsageNumber() const; @@ -50,4 +54,53 @@ class Xbox360ControllerClass : public IOHIDDevice virtual OSNumber* newVendorIDNumber() const; virtual OSNumber* newLocationIDNumber() const; + + virtual void remapButtons(void *buffer); +}; + + +class XboxOriginalControllerClass : public Xbox360ControllerClass +{ + OSDeclareDefaultStructors(XboxOriginalControllerClass) + +private: + UInt8 lastData[32]; + UInt32 repeatCount; + +public: + virtual IOReturn setReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options=0); + virtual IOReturn handleReport( + IOMemoryDescriptor * report, + IOHIDReportType reportType = kIOHIDReportTypeInput, + IOOptionBits options = 0 ); + + virtual OSString* newManufacturerString() const; + virtual OSNumber* newProductIDNumber() const; + virtual OSNumber* newVendorIDNumber() const; + virtual OSString* newProductString() const; +}; + + +class XboxOneControllerClass : public Xbox360ControllerClass +{ + OSDeclareDefaultStructors(XboxOneControllerClass) + +#define XboxOne_Prepare(x,t) {memset(&x,0,sizeof(x));x.header.command=t;x.header.size=sizeof(x-4);} + +private: + UInt8 lastData[20]; + bool isXboxOneGuideButtonPressed; + +public: + virtual IOReturn setReport(IOMemoryDescriptor *report,IOHIDReportType reportType,IOOptionBits options=0); + virtual IOReturn handleReport( + IOMemoryDescriptor * report, + IOHIDReportType reportType = kIOHIDReportTypeInput, + IOOptionBits options = 0 ); + + virtual OSString* newManufacturerString() const; + virtual OSNumber* newProductIDNumber() const; + virtual OSNumber* newVendorIDNumber() const; + virtual OSString* newProductString() const; + virtual void convertFromXboxOne(void *buffer, void* override); }; diff --git a/360Controller/English.lproj/InfoPlist.strings b/360Controller/English.lproj/InfoPlist.strings index 068787e..4a8156e 100644 --- a/360Controller/English.lproj/InfoPlist.strings +++ b/360Controller/English.lproj/InfoPlist.strings @@ -1,4 +1,4 @@ /* Localized versions of Info.plist keys */ CFBundleName = "360Controller"; -NSHumanReadableCopyright = "© Colin Munro, 2005-11"; \ No newline at end of file +NSHumanReadableCopyright = "© Colin Munro, 2005-11"; diff --git a/360Controller/Info copy.plist b/360Controller/Info copy.plist deleted file mode 100644 index b06cc87..0000000 --- a/360Controller/Info copy.plist +++ /dev/null @@ -1,56 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - 360Controller - CFBundleIconFile - - CFBundleIdentifier - com.mice.driver.Xbox360Controller - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - KEXT - CFBundleSignature - ???? - CFBundleVersion - 1.0.0d1 - IOKitPersonalities - - Controller - - CFBundleIdentifier - com.mice.driver.Xbox360Controller - IOCFPlugInTypes - - F4545CE5-BF5B-11D6-A4BB-0003933E3E3E - 360Controller.kext/Contents/PlugIns/Feedback360.plugin - - IOClass - Xbox360ControllerClass - IOKitDebug - 65535 - IOProviderClass - IOUSBDevice - idProduct - 654 - idVendor - 1118 - - - OSBundleLibraries - - com.apple.iokit.IOHIDFamily - 1.2 - com.apple.iokit.IOUSBFamily - 1.8 - com.apple.kernel.libkern - 6.9.9 - com.apple.kernel.mach - 6.9.9 - - - diff --git a/360Controller/Info.plist b/360Controller/Info.plist index 681fbe7..cf08805 100644 --- a/360Controller/Info.plist +++ b/360Controller/Info.plist @@ -6,8 +6,6 @@ English CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - CFBundleIdentifier com.mice.driver.Xbox360Controller CFBundleInfoDictionaryVersion @@ -19,10 +17,10 @@ CFBundleSignature ???? CFBundleVersion - 1.0.0d12 + ${CURRENT_PROJECT_VERSION} IOKitPersonalities - AfterglowGamepadforXbox360 + AfterglowGamepad1 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -38,11 +36,11 @@ IOProviderClass IOUSBDevice idProduct - 275 + 1043 idVendor 3695 - AfterglowGamepadforXbox360Z + ArcadeGameStick CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -58,11 +56,11 @@ IOProviderClass IOUSBDevice idProduct - 531 + 18264 idVendor - 3695 + 1848 - AfterglowGamepadforXbox360ZZ + BETOPGAMEFORWINDOWS CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -78,11 +76,11 @@ IOProviderClass IOUSBDevice idProduct - 63744 + 21766 idVendor - 7085 + 4544 - AviatorforXbox360PC + BatarangWired CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -98,11 +96,11 @@ IOProviderClass IOUSBDevice idProduct - 52009 + 16144 idVendor - 1848 + 5604 - BatarangwiredcontrollerXBOX + BigBenController CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -118,11 +116,22 @@ IOProviderClass IOUSBDevice idProduct - 16144 + 1537 idVendor - 5604 + 5227 + + ChatPadKeyboardEvents + + CFBundleIdentifier + com.apple.iokit.IOHIDFamily + IOClass + IOHIDEventDriver + IOProviderClass + IOHIDInterface + VendorID + 100 - BigbenControllerBB7201 + Chinese-madeXboxController CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -138,22 +147,31 @@ IOProviderClass IOUSBDevice idProduct - 1537 + 65535 idVendor - 5227 + 65535 - ChatPadKeyboardEvents + Controller CFBundleIdentifier - com.apple.iokit.IOHIDFamily + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + IOClass - IOHIDEventDriver + Xbox360Peripheral + IOKitDebug + 65535 IOProviderClass - IOHIDInterface - VendorID - 100 + IOUSBDevice + idProduct + 654 + idVendor + 1118 - Controller + DOA4Stick CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -169,11 +187,11 @@ IOProviderClass IOUSBDevice idProduct - 62465 + 10 idVendor - 1848 + 3853 - ControllerZ + GameStopGamepad3 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -189,11 +207,11 @@ IOProviderClass IOUSBDevice idProduct - 62721 + 1025 idVendor 3695 - ControllerZZ + GameStopGamepad4 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -209,11 +227,11 @@ IOProviderClass IOUSBDevice idProduct - 63489 + 769 idVendor - 5168 + 3695 - ControllerZZZ + GamestopGamepad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -229,11 +247,11 @@ IOProviderClass IOUSBDevice idProduct - 654 + 770 idVendor - 7085 + 4779 - ControllerZZZZ + GamestopGamepad2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -249,11 +267,11 @@ IOProviderClass IOUSBDevice idProduct - 64001 + 63745 idVendor 7085 - DDRUniverse2Mat + GenericController CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -269,11 +287,11 @@ IOProviderClass IOUSBDevice idProduct - 4 + 62209 idVendor - 4779 + 1133 - Ferrari458Racingwheel + GuitarHero CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -289,11 +307,11 @@ IOProviderClass IOUSBDevice idProduct - 23296 + 18248 idVendor - 9414 + 5168 - GH4Guitar + HoriFSVX CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -309,11 +327,11 @@ IOProviderClass IOUSBDevice idProduct - 18228 + 62723 idVendor - 5168 + 7085 - GamepadF310 + HoriFightingStickEX2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -329,11 +347,11 @@ IOProviderClass IOUSBDevice idProduct - 49693 + 10 idVendor - 1133 + 3853 - GamepadforXbox360 + HoriFightingStickEX2B CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -349,11 +367,11 @@ IOProviderClass IOUSBDevice idProduct - 769 + 62725 idVendor - 3695 + 7085 - GamepadforXbox360Z + HoriFightingStickEX2C CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -369,11 +387,11 @@ IOProviderClass IOUSBDevice idProduct - 1025 + 13 idVendor - 3695 + 3853 - GamepadforXbox360ZZ + HoriPadEX2Turbo CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -389,11 +407,11 @@ IOProviderClass IOUSBDevice idProduct - 770 + 62721 idVendor - 4779 + 7085 - GamepadforXbox360ZZZ + HoriPadEXTurbo CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -409,11 +427,11 @@ IOProviderClass IOUSBDevice idProduct - 63746 + 12 idVendor - 7085 + 3853 - GamestopXbox360Controller + HoriRAPHayabusaXboxOne CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -429,11 +447,11 @@ IOProviderClass IOUSBDevice idProduct - 63745 + 62722 idVendor 7085 - GuitarHeroforPCMAC + HoriRAPVXSA CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -449,11 +467,11 @@ IOProviderClass IOUSBDevice idProduct - 18252 + 62722 idVendor - 5168 + 7085 - HORIPADEX2TURBO + HoriUnnamed CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -469,11 +487,11 @@ IOProviderClass IOUSBDevice idProduct - 62721 + 21760 idVendor 7085 - HarmonixDrumKitforXbox360 + HoriUnnamedBlueSolo CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -489,11 +507,11 @@ IOProviderClass IOUSBDevice idProduct - 3 + 64001 idVendor 7085 - HarmonixGuitarforXbox360 + IonDrumRocker CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -509,11 +527,11 @@ IOProviderClass IOUSBDevice idProduct - 2 + 304 idVendor 7085 - HoriCoDOA4FightStick + JoytekXbox360 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -529,11 +547,11 @@ IOProviderClass IOUSBDevice idProduct - 10 + 48879 idVendor - 3853 + 5678 - HoriFightingStickEx2 + KonamiDancePad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -549,11 +567,11 @@ IOProviderClass IOUSBDevice idProduct - 13 + 4 idVendor - 3853 + 4779 - HoriRealArcadeProEx + LogitechF310 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -569,11 +587,11 @@ IOProviderClass IOUSBDevice idProduct - 22 + 49693 idVendor - 3853 + 1133 - HoriRealArcadeProVXSA + LogitechF510 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -589,11 +607,11 @@ IOProviderClass IOUSBDevice idProduct - 21761 + 49694 idVendor - 9414 + 1133 - HoriSOULCALIBURVStick + LogitechF710 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -609,11 +627,11 @@ IOProviderClass IOUSBDevice idProduct - 21766 + 49695 idVendor - 9414 + 1133 - JoytechNeoSe + MVC2TEStick CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -629,11 +647,11 @@ IOProviderClass IOUSBDevice idProduct - 61485 + 61497 idVendor 7085 - JoytechNeoSeTake2 + MVC2TEStick2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -649,11 +667,11 @@ IOProviderClass IOUSBDevice idProduct - 48879 + 46904 idVendor - 5678 + 1848 - LogitechChillStream + MadCatzBrawlStick CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -669,11 +687,11 @@ IOProviderClass IOUSBDevice idProduct - 49730 + 61465 idVendor - 1133 + 7085 - LogitechF510 + MadCatzFPSPro CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -689,11 +707,11 @@ IOProviderClass IOUSBDevice idProduct - 49694 + 61479 idVendor - 1133 + 7085 - MadCatz360 + MadCatzFightPad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -709,11 +727,11 @@ IOProviderClass IOUSBDevice idProduct - 64769 + 61486 idVendor 7085 - MadCatzBeatPad + MadCatzFightStickNeo CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -729,11 +747,11 @@ IOProviderClass IOUSBDevice idProduct - 18240 + 61498 idVendor - 1848 + 7085 - MadCatzCallofDutyGamePad + MadCatzFightStickSoulCaliber CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -749,11 +767,11 @@ IOProviderClass IOUSBDevice idProduct - 61477 + 61503 idVendor 7085 - MadCatzFPSProGamePad + MadCatzFightStickTE2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -769,11 +787,11 @@ IOProviderClass IOUSBDevice idProduct - 61479 + 61568 idVendor 7085 - MadCatzGhostReconFSGamePad + MadCatzGamepad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -789,11 +807,11 @@ IOProviderClass IOUSBDevice idProduct - 61473 + 18198 idVendor - 7085 + 1848 - MadCatzMicroConGamePadPro + MadCatzGamepad2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -809,11 +827,11 @@ IOProviderClass IOUSBDevice idProduct - 18230 + 63746 idVendor - 1848 + 7085 - MadCatzMicroConGamePadProZ + MadCatzGamepad3 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -829,11 +847,11 @@ IOProviderClass IOUSBDevice idProduct - 61494 + 61642 idVendor 7085 - MadCatzPortableDrumKit + MadCatzMicroConGamepad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -849,11 +867,11 @@ IOProviderClass IOUSBDevice idProduct - 39025 + 18230 idVendor 1848 - MadCatzStreetFighterIVFightPad + MadCatzMicroGamepad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -869,11 +887,11 @@ IOProviderClass IOUSBDevice idProduct - 18216 + 18230 idVendor 1848 - MadCatzStreetFighterIVFightStickSE + MadCatzPad3 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -889,11 +907,11 @@ IOProviderClass IOUSBDevice idProduct - 18200 + 61462 idVendor - 1848 + 7085 - MadCatzXbox360Controller + MadCatzPortableDrum CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -909,11 +927,11 @@ IOProviderClass IOUSBDevice idProduct - 18198 + 39025 idVendor 1848 - MadCatzXbox360ControllerZ + MadCatzProGamepad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -933,7 +951,7 @@ idVendor 1848 - MadCatzXbox360ControllerZZ + MicrosoftCorp.XboxControllerS CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -949,11 +967,11 @@ IOProviderClass IOUSBDevice idProduct - 48879 + 649 idVendor - 1848 + 1118 - MadCatzXbox360ControllerZZZ + MicrosoftCorp.XboxControllerSHub CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -969,11 +987,11 @@ IOProviderClass IOUSBDevice idProduct - 61462 + 648 idVendor - 7085 + 1118 - MadCatzXboxcontrollerMW2 + MicrosoftX-Boxpad(Japan) CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -989,11 +1007,11 @@ IOProviderClass IOUSBDevice idProduct - 46886 + 645 idVendor - 1848 + 1118 - MicrosoftXbox360Controller + MicrosoftX-Boxpadv1(US) CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1009,11 +1027,11 @@ IOProviderClass IOUSBDevice idProduct - 654 + 514 idVendor 1118 - PDPAFTERGLOWAX1 + MicrosoftXboxControllerS CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1029,11 +1047,11 @@ IOProviderClass IOUSBDevice idProduct - 769 + 647 idVendor - 4779 + 1118 - PDPDancePad + MicrosoftXboxOneController CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1049,11 +1067,11 @@ IOProviderClass IOUSBDevice idProduct - 261 + 721 idVendor - 3695 + 1118 - PelicanTSZ360Pad + PDPAfterglow CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1069,11 +1087,31 @@ IOProviderClass IOUSBDevice idProduct - 513 + 63744 + idVendor + 7085 + + PDPAfterglowAX1 + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 275 idVendor 3695 - PowerAMiniProElite + PDPAfterglowV2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1089,11 +1127,11 @@ IOProviderClass IOUSBDevice idProduct - 16128 + 531 idVendor - 5604 + 3695 - PowerAMiniProEliteGlow + PDPMarvelXboxOneController CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1109,11 +1147,11 @@ IOProviderClass IOUSBDevice idProduct - 21248 + 327 idVendor - 9414 + 3695 - REALARCADEPROEX + PDPTron CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1129,11 +1167,11 @@ IOProviderClass IOUSBDevice idProduct - 62724 + 63747 idVendor 7085 - REALARCADEProVX + PDPVersusPad CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1149,11 +1187,11 @@ IOProviderClass IOUSBDevice idProduct - 62722 + 63748 idVendor 7085 - RazerOnza + PowerAAirflow CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1169,11 +1207,11 @@ IOProviderClass IOUSBDevice idProduct - 64768 + 16138 idVendor - 5769 + 5604 - RazerOnzaTournamentEdition + PowerAMiniProEXGreen CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1189,11 +1227,11 @@ IOProviderClass IOUSBDevice idProduct - 64769 + 16128 idVendor - 5769 + 5604 - RedOctaneGuitarHeroXplorer + PowerAMiniProEXGreen2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1209,11 +1247,11 @@ IOProviderClass IOUSBDevice idProduct - 18248 + 21274 idVendor - 5168 + 9414 - RockCandyGamepadforXbox360 + PowerAMiniProEXWhite CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1229,11 +1267,11 @@ IOProviderClass IOUSBDevice idProduct - 287 + 21248 idVendor - 3695 + 9414 - RockRevolutionforXbox360 + PowerAMiniXboxOne CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1249,11 +1287,11 @@ IOProviderClass IOUSBDevice idProduct - 6 + 21530 idVendor - 4779 + 9414 - SaitekCyborgRumblePadPCXbox360 + PowerASpectraIlluminatedXboxOne CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1269,11 +1307,11 @@ IOProviderClass IOUSBDevice idProduct - 51970 + 21546 idVendor - 1848 + 9414 - SaitekP3200RumblePadPCXbox360 + RAPEXSE CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1289,11 +1327,11 @@ IOProviderClass IOUSBDevice idProduct - 51971 + 22 idVendor - 1848 + 3853 - StreetFighterIVFightPad + RazerOnza CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1309,11 +1347,11 @@ IOProviderClass IOUSBDevice idProduct - 61480 + 64769 idVendor 7085 - StreetFighterIVFightStickTE + RazerOnza2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1329,11 +1367,11 @@ IOProviderClass IOUSBDevice idProduct - 18232 + 64769 idVendor - 1848 + 5769 - SuperSFIVFightStickTES + RazerOnzaTE CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1349,11 +1387,11 @@ IOProviderClass IOUSBDevice idProduct - 63288 + 64768 idVendor - 1848 + 7085 - TronXbox360controller + RazerOnzaTE2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1369,11 +1407,11 @@ IOProviderClass IOUSBDevice idProduct - 63747 + 64768 idVendor - 7085 + 5769 - USBGamepad + RazerSabertoothElite CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1389,11 +1427,11 @@ IOProviderClass IOUSBDevice idProduct - 21760 + 65024 idVendor - 7085 + 5769 - XB360MortalKombatFightStick + RazerSabertoothElite2 CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1409,11 +1447,11 @@ IOProviderClass IOUSBDevice idProduct - 63750 + 23812 idVendor - 7085 + 9414 - XboxAirflowiredcontroller + RedOctaneController CFBundleIdentifier com.mice.driver.Xbox360Controller @@ -1429,9 +1467,409 @@ IOProviderClass IOUSBDevice idProduct - 16138 + 63489 idVendor - 5604 + 5168 + + RockBandDrums + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 3 + idVendor + 7085 + + RockBandGuitar + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 2 + idVendor + 7085 + + RockCandy + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 287 + idVendor + 3695 + + RockCandyGamepadForXbox360 + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 543 + idVendor + 3695 + + RockCandyGamepadforXboxOne + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 326 + idVendor + 3695 + + SC4VF5Stick + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 13 + idVendor + 3853 + + SF4FightPad + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 61480 + idVendor + 7085 + + SF4FightPad2 + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 18216 + idVendor + 1848 + + SF4StickSE + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 18200 + idVendor + 1848 + + SF4StickTE + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 18232 + idVendor + 1848 + + SF4StickTER2 + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 61496 + idVendor + 7085 + + SSF4StickTE + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 63288 + idVendor + 1848 + + SSFIVTEChunLi + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 61501 + idVendor + 7085 + + SaitekCB360 + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 51970 + idVendor + 1848 + + StrikeController + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 1 + idVendor + 5769 + + TSZPelican + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 513 + idVendor + 3695 + + ThrustMasterGPXGamepad + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 45862 + idVendor + 1103 + + ThrustmasterGPXLightback + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 23298 + idVendor + 9414 + + XB360MortalKombatFightStick + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 63750 + idVendor + 7085 + + Xbox360ProEXController + + CFBundleIdentifier + com.mice.driver.Xbox360Controller + IOCFPlugInTypes + + F4545CE5-BF5B-11D6-A4BB-0003933E3E3E + 360Controller.kext/Contents/PlugIns/Feedback360.plugin + + IOClass + Xbox360Peripheral + IOKitDebug + 65535 + IOProviderClass + IOUSBDevice + idProduct + 21258 + idVendor + 9414 NSHumanReadableCopyright diff --git a/360Controller/_60Controller.cpp b/360Controller/_60Controller.cpp index faecb56..f311fe7 100644 --- a/360Controller/_60Controller.cpp +++ b/360Controller/_60Controller.cpp @@ -55,9 +55,8 @@ class LockRequired // Find the maximum packet size of this pipe static UInt32 GetMaxPacketSize(IOUSBPipe *pipe) { - const IOUSBEndpointDescriptor *ed; + const IOUSBEndpointDescriptor *ed = pipe->GetEndpointDescriptor(); - ed=pipe->GetEndpointDescriptor(); if(ed==NULL) return 0; else return ed->wMaxPacketSize; } @@ -99,9 +98,13 @@ bool Xbox360Peripheral::SendSwitch(bool sendOut) controlReq.wIndex = 0xe416; controlReq.wLength = sizeof(chatpadInit); controlReq.pData = chatpadInit; - if (device->DeviceRequest(&controlReq, 100, 100, NULL) == kIOReturnSuccess) + IOReturn err = device->DeviceRequest(&controlReq, 100, 100, NULL); + if (err == kIOReturnSuccess) return true; - IOLog("start - failed to %s chatpad setting\n", sendOut ? "write" : "read"); + + const char *errStr = device->stringFromReturn(err); + IOLog("start - failed to %s chatpad setting (%x): %s\n", + sendOut ? "write" : "read", err, errStr); return false; } @@ -223,34 +226,71 @@ void Xbox360Peripheral::ChatPadTimerAction(IOTimerEventSource *sender) // Read the settings from the registry void Xbox360Peripheral::readSettings(void) { - OSDictionary *dataDictionary; - OSBoolean *value; - OSNumber *number; + OSBoolean *value = NULL; + OSNumber *number = NULL; + OSDictionary *dataDictionary = OSDynamicCast(OSDictionary, getProperty(kDriverSettingKey)); - dataDictionary=OSDynamicCast(OSDictionary,getProperty(kDriverSettingKey)); - if(dataDictionary==NULL) return; - value=OSDynamicCast(OSBoolean,dataDictionary->getObject("InvertLeftX")); - if(value!=NULL) invertLeftX=value->getValue(); - value=OSDynamicCast(OSBoolean,dataDictionary->getObject("InvertLeftY")); - if(value!=NULL) invertLeftY=value->getValue(); - value=OSDynamicCast(OSBoolean,dataDictionary->getObject("InvertRightX")); - if(value!=NULL) invertRightX=value->getValue(); - value=OSDynamicCast(OSBoolean,dataDictionary->getObject("InvertRightY")); - if(value!=NULL) invertRightY=value->getValue(); - number=OSDynamicCast(OSNumber,dataDictionary->getObject("DeadzoneLeft")); - if(number!=NULL) deadzoneLeft=number->unsigned32BitValue(); - number=OSDynamicCast(OSNumber,dataDictionary->getObject("DeadzoneRight")); - if(number!=NULL) deadzoneRight=number->unsigned32BitValue(); - value=OSDynamicCast(OSBoolean,dataDictionary->getObject("RelativeLeft")); - if(value!=NULL) relativeLeft=value->getValue(); - value=OSDynamicCast(OSBoolean,dataDictionary->getObject("RelativeRight")); - if(value!=NULL) relativeRight=value->getValue(); - /* + if (dataDictionary == NULL) return; + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftX")); + if (value != NULL) invertLeftX = value->getValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertLeftY")); + if (value != NULL) invertLeftY = value->getValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightX")); + if (value != NULL) invertRightX = value->getValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("InvertRightY")); + if (value != NULL) invertRightY = value->getValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneLeft")); + if (number != NULL) deadzoneLeft = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("DeadzoneRight")); + if (number != NULL) deadzoneRight = number->unsigned32BitValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeLeft")); + if (value != NULL) relativeLeft = value->getValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("RelativeRight")); + if (value != NULL) relativeRight=value->getValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("DeadOffLeft")); + if (value != NULL) deadOffLeft = value->getValue(); + value = OSDynamicCast(OSBoolean, dataDictionary->getObject("DeadOffRight")); + if (value != NULL) deadOffRight = value->getValue(); +// number = OSDynamicCast(OSNumber, dataDictionary->getObject("ControllerType")); // No use currently. + number = OSDynamicCast(OSNumber, dataDictionary->getObject("rumbleType")); + if (number != NULL) rumbleType = number->unsigned8BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingUp")); + if (number != NULL) mapping[0] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingDown")); + if (number != NULL) mapping[1] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingLeft")); + if (number != NULL) mapping[2] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingRight")); + if (number != NULL) mapping[3] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingStart")); + if (number != NULL) mapping[4] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingBack")); + if (number != NULL) mapping[5] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingLSC")); + if (number != NULL) mapping[6] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingRSC")); + if (number != NULL) mapping[7] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingLB")); + if (number != NULL) mapping[8] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingRB")); + if (number != NULL) mapping[9] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingGuide")); + if (number != NULL) mapping[10] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingA")); + if (number != NULL) mapping[11] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingB")); + if (number != NULL) mapping[12] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingX")); + if (number != NULL) mapping[13] = number->unsigned32BitValue(); + number = OSDynamicCast(OSNumber, dataDictionary->getObject("BindingY")); + if (number != NULL) mapping[14] = number->unsigned32BitValue(); + +#if 0 IOLog("Xbox360Peripheral preferences loaded:\n invertLeft X: %s, Y: %s\n invertRight X: %s, Y:%s\n deadzone Left: %d, Right: %d\n\n", invertLeftX?"True":"False",invertLeftY?"True":"False", invertRightX?"True":"False",invertRightY?"True":"False", deadzoneLeft,deadzoneRight); - */ +#endif } // Initialise the extension @@ -270,10 +310,23 @@ bool Xbox360Peripheral::init(OSDictionary *propTable) serialTimer = NULL; serialHandler = NULL; // Default settings - invertLeftX=invertLeftY=FALSE; - invertRightX=invertRightY=FALSE; + invertLeftX=invertLeftY=false; + invertRightX=invertRightY=false; deadzoneLeft=deadzoneRight=0; - relativeLeft=relativeRight=FALSE; + relativeLeft=relativeRight=false; + deadOffLeft = false; + deadOffRight = false; + // Controller Specific + rumbleType = 0; + // Bindings + for (int i = 0; i < 11; i++) + { + mapping[i] = i; + } + for (int i = 12; i < 16; i++) + { + mapping[i-1] = i; + } // Done return res; } @@ -292,6 +345,15 @@ bool Xbox360Peripheral::start(IOService *provider) IOUSBFindEndpointRequest pipe; XBOX360_OUT_LED led; IOWorkLoop *workloop = NULL; + /* + * Xbox One controller init packets. + * The Rock Candy Xbox One controller requires more than just 0x05 + * Minimum required packets unknown. + */ + UInt8 xoneInitFirst[] = { 0x02, 0x20, 0x01, 0x1C, 0x7E, 0xED, 0x8B, 0x11, 0x0F, 0xA8, 0x00, 0x00, 0x5E, 0x04, 0xD1, 0x02, 0x01, 0x00, 0x01, 0x00, 0x17, 0x01, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00 }; + UInt8 xoneInitSecond[] = { 0x05, 0x20, 0x00, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x53 }; + UInt8 xoneInitThird[] = { 0x05, 0x20, 0x01, 0x01, 0x00 }; + UInt8 xoneInitFourth[] = { 0x0A, 0x20, 0x02, 0x03, 0x00, 0x01, 0x14 }; if (!super::start(provider)) return false; @@ -329,7 +391,7 @@ bool Xbox360Peripheral::start(IOService *provider) UInt16 release = device->GetDeviceRelease(); switch (release) { default: - IOLog("Unknown device release %.4x", release); + IOLog("Unknown device release %.4x\n", release); // fall through case 0x0110: chatpadInit[0] = 0x01; @@ -342,15 +404,38 @@ bool Xbox360Peripheral::start(IOService *provider) } } // Find correct interface + controllerType = Xbox360; intf.bInterfaceClass=kIOUSBFindInterfaceDontCare; intf.bInterfaceSubClass=93; intf.bInterfaceProtocol=1; intf.bAlternateSetting=kIOUSBFindInterfaceDontCare; interface=device->FindNextInterface(NULL,&intf); if(interface==NULL) { - IOLog("start - unable to find the interface\n"); - goto fail; + // Find correct interface, Xbox original + intf.bInterfaceClass=kIOUSBFindInterfaceDontCare; + intf.bInterfaceSubClass=66; + intf.bInterfaceProtocol=0; + intf.bAlternateSetting=kIOUSBFindInterfaceDontCare; + interface=device->FindNextInterface(NULL,&intf); + if(interface==NULL) { + // Find correct interface, Xbox One + intf.bInterfaceClass=255; + intf.bInterfaceSubClass=71; + intf.bInterfaceProtocol=208; + intf.bAlternateSetting=kIOUSBFindInterfaceDontCare; + interface=device->FindNextInterface(NULL, &intf); + if(interface==NULL) + { + IOLog("start - unable to find the interface\n"); + goto fail; + } + controllerType = XboxOne; + goto interfacefound; + } + controllerType = XboxOriginal; + goto interfacefound; } +interfacefound: interface->open(this); // Find pipes pipe.direction=kUSBIn; @@ -420,14 +505,16 @@ bool Xbox360Peripheral::start(IOService *provider) goto fail; } // Configure ChatPad - // Send 'configuration' + // Send 'configuration' SendInit(0xa30c, 0x4423); SendInit(0x2344, 0x7f03); SendInit(0x5839, 0x6832); - // Set 'switch' - if ((!SendSwitch(false)) || (!SendSwitch(true)) || (!SendSwitch(false))) - goto fail; - // Begin toggle + // Set 'switch' + if ((!SendSwitch(false)) || (!SendSwitch(true)) || (!SendSwitch(false))) { + // Commenting goto fail fixes the driver for the Hori Real Arcade Pro EX + //goto fail; + } + // Begin toggle serialHeard = false; serialActive = false; serialToggle = false; @@ -440,10 +527,18 @@ bool Xbox360Peripheral::start(IOService *provider) nochat: if (!QueueRead()) goto fail; - // Disable LED - Xbox360_Prepare(led,outLed); - led.pattern=ledOff; - QueueWrite(&led,sizeof(led)); + if (controllerType == XboxOne) { + QueueWrite(&xoneInitFirst, sizeof(xoneInitFirst)); + QueueWrite(&xoneInitSecond, sizeof(xoneInitSecond)); + QueueWrite(&xoneInitThird, sizeof(xoneInitThird)); + QueueWrite(&xoneInitFourth, sizeof(xoneInitFourth)); + } else { + // Disable LED + Xbox360_Prepare(led,outLed); + led.pattern=ledOff; + QueueWrite(&led,sizeof(led)); + } + // Done PadConnect(); registerService(); @@ -578,14 +673,21 @@ void Xbox360Peripheral::ReleaseAll(void) } } +// Handle termination +bool Xbox360Peripheral::didTerminate(IOService *provider, IOOptionBits options, bool *defer) +{ + // release all objects used and close the device + ReleaseAll(); + return super::didTerminate(provider, options, defer); +} + + // Handle message sent to the driver IOReturn Xbox360Peripheral::message(UInt32 type,IOService *provider,void *argument) { switch(type) { case kIOMessageServiceIsTerminated: case kIOMessageServiceIsRequestingClose: - if(device->isOpen(this)) ReleaseAll(); - return kIOReturnSuccess; default: return super::message(type,provider,argument); } @@ -620,9 +722,63 @@ void Xbox360Peripheral::fiddleReport(IOBufferMemoryDescriptor *buffer) report->left.x=0; report->left.y=0; } + else if(deadOffLeft) { + const UInt16 max16=32767; + float maxVal=max16-deadzoneLeft; + float valX=getAbsolute(report->left.x); + if (valX>deadzoneLeft) { + if (report->left.x<0) { + report->left.x=max16*(valX-deadzoneLeft)/maxVal; + report->left.x=~report->left.x; + } else { + report->left.x=max16*(valX-deadzoneLeft)/maxVal; + } + } else { + report->left.x=0; + } + float valY=getAbsolute(report->left.y); + if (valY>deadzoneLeft) { + if (report->left.y<0) { + report->left.y=max16*(valY-deadzoneLeft)/maxVal; + report->left.y=~report->left.y; + } else { + report->left.y=max16*(valY-deadzoneLeft)/maxVal; + } + } else { + report->left.y=0; + } + } } else { - if(getAbsolute(report->left.x)left.x=0; - if(getAbsolute(report->left.y)left.y=0; + if(getAbsolute(report->left.x)left.x=0; + else if (deadOffLeft) + { + const UInt16 max16=32767; + float maxVal=max16-deadzoneLeft; + if (report->left.x<0) { + float valX=getAbsolute(report->left.x); + report->left.x=max16*(valX-deadzoneLeft)/maxVal; + report->left.x=~report->left.x; + } else { + float valX=getAbsolute(report->left.x); + report->left.x=max16*(valX-deadzoneLeft)/maxVal; + } + } + if(getAbsolute(report->left.y)left.y=0; + else if (deadOffLeft) + { + const UInt16 max16=32767; + float maxVal = max16-deadzoneLeft; + if (report->left.y<0) { + float valY=getAbsolute(report->left.y); + report->left.y=max16*(valY-deadzoneLeft)/maxVal; + report->left.y=~report->left.y; + } else { + float valY=getAbsolute(report->left.y); + report->left.y=max16*(valY-deadzoneLeft)/maxVal; + } + } } } if(deadzoneRight!=0) { @@ -631,9 +787,63 @@ void Xbox360Peripheral::fiddleReport(IOBufferMemoryDescriptor *buffer) report->right.x=0; report->right.y=0; } + else if(deadOffRight) { + const UInt16 max16=32767; + float maxVal=max16-deadzoneRight; + float valX=getAbsolute(report->right.x); + if (valX>deadzoneRight) { + if (report->right.x<0) { + report->right.x=max16*(valX-deadzoneRight)/maxVal; + report->right.x=~report->right.x; + } else { + report->right.x=max16*(valX-deadzoneRight)/maxVal; + } + } else { + report->right.x = 0; + } + float valY=getAbsolute(report->right.y); + if (valY>deadzoneRight) { + if (report->right.y<0) { + report->right.y=max16*(valY-deadzoneRight)/maxVal; + report->right.y=~report->right.y; + } else { + report->right.y=max16*(valY-deadzoneRight)/maxVal; + } + } else { + report->right.y = 0; + } + } } else { - if(getAbsolute(report->right.x)right.x=0; - if(getAbsolute(report->right.y)right.y=0; + if(getAbsolute(report->right.x)right.x=0; + else if (deadOffRight) + { + const UInt16 max16=32767; + float maxVal=max16-deadzoneRight; + if (report->right.x<0) { + float valX=getAbsolute(report->right.x); + report->right.x=max16*(valX-deadzoneRight)/maxVal; + report->right.x=~report->right.x; + } else { + float valX=getAbsolute(report->right.x); + report->right.x=max16*(valX-deadzoneRight)/maxVal; + } + } + if(getAbsolute(report->right.y)right.y=0; + else if (deadOffRight) + { + const UInt16 max16=32767; + float maxVal=max16-deadzoneRight; + if (report->right.y<0) { + float valY=getAbsolute(report->right.y); + report->right.y=max16*(valY-deadzoneRight)/maxVal; + report->right.y=~report->right.y; + } else { + float valY=getAbsolute(report->right.y); + report->right.y=max16*(valY-deadzoneRight)/maxVal; + } + } } } } @@ -661,40 +871,40 @@ void Xbox360Peripheral::WriteCompleteInternal(void *target,void *parameter,IORet // This handles a completed asynchronous read void Xbox360Peripheral::ReadComplete(void *parameter,IOReturn status,UInt32 bufferSizeRemaining) { - if (padHandler != NULL) // avoid deadlock with release - { - LockRequired locker(mainLock); - IOReturn err; - bool reread=!isInactive(); - - switch(status) { - case kIOReturnOverrun: - IOLog("read - kIOReturnOverrun, clearing stall\n"); - if (inPipe != NULL) - inPipe->ClearStall(); - // Fall through - case kIOReturnSuccess: - if (inBuffer != NULL) - { - const XBOX360_IN_REPORT *report=(const XBOX360_IN_REPORT*)inBuffer->getBytesNoCopy(); - if((report->header.command==inReport)&&(report->header.size==sizeof(XBOX360_IN_REPORT))) { - fiddleReport(inBuffer); - err = padHandler->handleReport(inBuffer, kIOHIDReportTypeInput); - if(err!=kIOReturnSuccess) { - IOLog("read - failed to handle report: 0x%.8x\n",err); - } - } - } - break; - case kIOReturnNotResponding: - IOLog("read - kIOReturnNotResponding\n"); - reread=false; - break; - default: - reread=false; - break; - } - if(reread) QueueRead(); + if (padHandler != NULL) // avoid deadlock with release + { + LockRequired locker(mainLock); + IOReturn err; + bool reread=!isInactive(); + + switch(status) { + case kIOReturnOverrun: + IOLog("read - kIOReturnOverrun, clearing stall\n"); + if (inPipe != NULL) + inPipe->ClearStall(); + // Fall through + case kIOReturnSuccess: + if (inBuffer != NULL) + { + const XBOX360_IN_REPORT *report=(const XBOX360_IN_REPORT*)inBuffer->getBytesNoCopy(); + if(((report->header.command==inReport)&&(report->header.size==sizeof(XBOX360_IN_REPORT))) + || (report->header.command==0x20) || (report->header.command==0x07)) /* Xbox One */ { + err = padHandler->handleReport(inBuffer, kIOHIDReportTypeInput); + if(err!=kIOReturnSuccess) { + IOLog("read - failed to handle report: 0x%.8x\n",err); + } + } + } + break; + case kIOReturnNotResponding: + IOLog("read - kIOReturnNotResponding\n"); + reread=false; + break; + default: + reread=false; + break; + } + if(reread) QueueRead(); } } @@ -749,7 +959,9 @@ IOReturn Xbox360Peripheral::setProperties(OSObject *properties) OSDictionary *dictionary; dictionary=OSDynamicCast(OSDictionary,properties); + if(dictionary!=NULL) { + dictionary->setObject(OSString::withCString("ControllerType"), OSNumber::withNumber(controllerType, 8)); setProperty(kDriverSettingKey,dictionary); readSettings(); return kIOReturnSuccess; @@ -774,7 +986,13 @@ IOHIDDevice* Xbox360Peripheral::getController(int index) void Xbox360Peripheral::PadConnect(void) { PadDisconnect(); - padHandler = new Xbox360ControllerClass; + if (controllerType == XboxOriginal) { + padHandler = new XboxOriginalControllerClass; + } else if (controllerType == XboxOne) { + padHandler = new XboxOneControllerClass; + } else { + padHandler = new Xbox360ControllerClass; + } if (padHandler != NULL) { const OSString *keys[] = { @@ -787,7 +1005,7 @@ void Xbox360Peripheral::PadConnect(void) getProperty("IOCFPlugInTypes"), OSNumber::withNumber((unsigned long long)65535, 32), }; - OSDictionary *dictionary = OSDictionary::withObjects(objects, keys, sizeof(keys) / sizeof(keys[0]), 0); + OSDictionary *dictionary = OSDictionary::withObjects(objects, keys, sizeof(keys) / sizeof(keys[0])); if (padHandler->init(dictionary)) { padHandler->attach(this); diff --git a/360Controller/_60Controller.h b/360Controller/_60Controller.h index ea02aad..721cad5 100644 --- a/360Controller/_60Controller.h +++ b/360Controller/_60Controller.h @@ -44,9 +44,7 @@ class Xbox360Peripheral : public IOService static void WriteCompleteInternal(void *target,void *parameter,IOReturn status,UInt32 bufferSizeRemaining); void SerialReadComplete(void *parameter, IOReturn status, UInt32 bufferSizeRemaining); - - void fiddleReport(IOBufferMemoryDescriptor *buffer); - + void readSettings(void); static void ChatPadTimerActionWrapper(OSObject *owner, IOTimerEventSource *sender); @@ -64,7 +62,7 @@ class Xbox360Peripheral : public IOService void SerialMessage(IOBufferMemoryDescriptor *data, size_t length); protected: - typedef enum { + typedef enum TIMER_STATE { tsToggle, tsReset1, tsReset2, @@ -73,6 +71,12 @@ class Xbox360Peripheral : public IOService tsSet2, tsSet3, } TIMER_STATE; + + typedef enum CONTROLLER_TYPE { + Xbox360 = 0, + XboxOriginal = 1, + XboxOne = 2 + } CONTROLLER_TYPE; IOUSBDevice *device; IOLock *mainLock; @@ -93,14 +97,21 @@ class Xbox360Peripheral : public IOService ChatPadKeyboardClass *serialHandler; Xbox360ControllerClass *padHandler; UInt8 chatpadInit[2]; + CONTROLLER_TYPE controllerType; // Settings bool invertLeftX,invertLeftY; bool invertRightX,invertRightY; short deadzoneLeft,deadzoneRight; bool relativeLeft,relativeRight; - + bool deadOffLeft, deadOffRight; + public: + // Controller specific + UInt8 rumbleType; + + UInt8 mapping[15]; + // this is from the IORegistryEntry - no provider yet virtual bool init(OSDictionary *propTable); virtual void free(void); @@ -113,12 +124,15 @@ class Xbox360Peripheral : public IOService virtual IOReturn setProperties(OSObject *properties); virtual IOReturn message(UInt32 type, IOService *provider, void *argument); + + virtual bool didTerminate(IOService *provider, IOOptionBits options, bool *defer); // Hooks virtual void ReadComplete(void *parameter,IOReturn status,UInt32 bufferSizeRemaining); virtual void WriteComplete(void *parameter,IOReturn status,UInt32 bufferSizeRemaining); bool QueueWrite(const void *bytes,UInt32 length); + virtual void fiddleReport(IOBufferMemoryDescriptor *buffer); IOHIDDevice* getController(int index); }; diff --git a/360Controller/chatpadhid.h b/360Controller/chatpadhid.h old mode 100755 new mode 100644 index a7d3c1e..dcd7d51 --- a/360Controller/chatpadhid.h +++ b/360Controller/chatpadhid.h @@ -1,58 +1,57 @@ -/* - MICE Xbox 360 Controller driver for Mac OS X - Copyright (C) 2006-2013 Colin Munro - - chatpadhid.h - a HID descriptor for the Microsoft ChatPad accessory - - This file is part of Xbox360Controller. - - Xbox360Controller is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Xbox360Controller is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Foobar; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -// F:\Documents and Settings\Desktop\hid\ChatPad_Keyboard.h - - -char ReportDescriptor[58] = { - 0x05, 0x01, // USAGE_PAGE (Generic Desktop) - 0x09, 0x06, // USAGE (Keyboard) - 0xa1, 0x01, // COLLECTION (Application) - 0x25, 0x00, // LOGICAL_MAXIMUM (0) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x75, 0x08, // REPORT_SIZE (8) - 0x95, 0x01, // REPORT_COUNT (1) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - 0x05, 0x07, // USAGE_PAGE (Keyboard) - 0x09, 0xe1, // USAGE (Keyboard LeftShift) - 0x09, 0xe0, // USAGE (Keyboard LeftControl) - 0x09, 0xe2, // USAGE (Keyboard LeftAlt) - 0x09, 0xe3, // USAGE (Keyboard Left GUI) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x25, 0x01, // LOGICAL_MAXIMUM (1) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x04, // REPORT_COUNT (4) - 0x81, 0x02, // INPUT (Data,Var,Abs) - 0x75, 0x01, // REPORT_SIZE (1) - 0x95, 0x04, // REPORT_COUNT (4) - 0x81, 0x03, // INPUT (Cnst,Var,Abs) - 0x95, 0x03, // REPORT_COUNT (3) - 0x75, 0x08, // REPORT_SIZE (8) - 0x15, 0x00, // LOGICAL_MINIMUM (0) - 0x26, 0xe7, 0x00, // LOGICAL_MAXIMUM (231) - 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) - 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) - 0x81, 0x00, // INPUT (Data,Ary,Abs) - 0xc0 // END_COLLECTION -}; - +/* + MICE Xbox 360 Controller driver for Mac OS X + Copyright (C) 2006-2013 Colin Munro + + chatpadhid.h - a HID descriptor for the Microsoft ChatPad accessory + + This file is part of Xbox360Controller. + + Xbox360Controller is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Xbox360Controller is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Foobar; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +// F:\Documents and Settings\Desktop\hid\ChatPad_Keyboard.h + + +static const unsigned char ReportDescriptor[] = { + 0x05, 0x01, // USAGE_PAGE (Generic Desktop) + 0x09, 0x06, // USAGE (Keyboard) + 0xa1, 0x01, // COLLECTION (Application) + 0x25, 0x00, // LOGICAL_MAXIMUM (0) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x75, 0x08, // REPORT_SIZE (8) + 0x95, 0x01, // REPORT_COUNT (1) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x05, 0x07, // USAGE_PAGE (Keyboard) + 0x09, 0xe1, // USAGE (Keyboard LeftShift) + 0x09, 0xe0, // USAGE (Keyboard LeftControl) + 0x09, 0xe2, // USAGE (Keyboard LeftAlt) + 0x09, 0xe3, // USAGE (Keyboard Left GUI) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x25, 0x01, // LOGICAL_MAXIMUM (1) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x04, // REPORT_COUNT (4) + 0x81, 0x02, // INPUT (Data,Var,Abs) + 0x75, 0x01, // REPORT_SIZE (1) + 0x95, 0x04, // REPORT_COUNT (4) + 0x81, 0x03, // INPUT (Cnst,Var,Abs) + 0x95, 0x03, // REPORT_COUNT (3) + 0x75, 0x08, // REPORT_SIZE (8) + 0x15, 0x00, // LOGICAL_MINIMUM (0) + 0x26, 0xe7, 0x00, // LOGICAL_MAXIMUM (231) + 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated)) + 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI) + 0x81, 0x00, // INPUT (Data,Ary,Abs) + 0xc0 // END_COLLECTION +}; diff --git a/360Controller/chatpadkeys.cpp b/360Controller/chatpadkeys.cpp index f97dba0..7c46b79 100644 --- a/360Controller/chatpadkeys.cpp +++ b/360Controller/chatpadkeys.cpp @@ -23,7 +23,7 @@ #include "chatpadkeys.h" -#define ROW_SIZE 8 +#define ROW_SIZE 8 typedef struct MAP_DATA { unsigned char row[ROW_SIZE]; @@ -42,12 +42,11 @@ static const MAP_DATA columns[] = { unsigned char ChatPad2USB(unsigned char input) { - unsigned char row, column; + unsigned char row = input & 0x0F; + unsigned char column = (input & 0xF0) >> 4; - row = input & 0x0F; if (row >= ROW_SIZE) return 0x00; - column = (input & 0xF0) >> 4; if (column >= (sizeof(columns) / sizeof(columns[0]))) return 0x00; return columns[column].row[row]; diff --git a/360Controller/version.plist b/360Controller/version.plist deleted file mode 100644 index 53bf3a3..0000000 --- a/360Controller/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 12 - CFBundleVersion - 1.0 - ProductBuildVersion - 7K571 - ProjectName - DevToolsWizardTemplates - SourceVersion - 3870000 - - diff --git a/360Controller/xbox360hid.h b/360Controller/xbox360hid.h index ccafb6e..e8ae185 100644 --- a/360Controller/xbox360hid.h +++ b/360Controller/xbox360hid.h @@ -28,7 +28,7 @@ * just kept working with this one anyway :) */ -char ReportDescriptor[196] = { +static const unsigned char ReportDescriptor[] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 0x09, 0x05, // USAGE (Game Pad) 0xa1, 0x01, // COLLECTION (Application) @@ -122,4 +122,4 @@ char ReportDescriptor[196] = { 0xc0, // END_COLLECTION 0xc0, // END_COLLECTION 0xc0 // END_COLLECTION -}; \ No newline at end of file +}; diff --git a/360Daemon/360Daemon.1 b/360Daemon/360Daemon.1 deleted file mode 100644 index b523c0c..0000000 --- a/360Daemon/360Daemon.1 +++ /dev/null @@ -1,79 +0,0 @@ -.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. -.\"See Also: -.\"man mdoc.samples for a complete listing of options -.\"man mdoc for the short list of editing options -.\"/usr/share/misc/mdoc.template -.Dd 7/8/07 \" DATE -.Dt 360Daemon 1 \" Program name and manual section number -.Os Darwin -.Sh NAME \" Section Header - required - don't modify -.Nm 360Daemon, -.\" The following lines are read in generating the apropos(man -k) database. Use only key -.\" words here as the database is built based on the words here and in the .ND line. -.Nm Other_name_for_same_program(), -.Nm Yet another name for the same program. -.\" Use .Nm macro to designate other names for the documented program. -.Nd This line parsed for whatis database. -.Sh SYNOPSIS \" Section Header - required - don't modify -.Nm -.Op Fl abcd \" [-abcd] -.Op Fl a Ar path \" [-a path] -.Op Ar file \" [file] -.Op Ar \" [file ...] -.Ar arg0 \" Underlined argument - use .Ar anywhere to underline -arg2 ... \" Arguments -.Sh DESCRIPTION \" Section Header - required - don't modify -Use the .Nm macro to refer to your program throughout the man page like such: -.Nm -Underlining is accomplished with the .Ar macro like this: -.Ar underlined text . -.Pp \" Inserts a space -A list of items with descriptions: -.Bl -tag -width -indent \" Begins a tagged list -.It item a \" Each item preceded by .It macro -Description of item a -.It item b -Description of item b -.El \" Ends the list -.Pp -A list of flags and their descriptions: -.Bl -tag -width -indent \" Differs from above in tag removed -.It Fl a \"-a flag as a list item -Description of -a flag -.It Fl b -Description of -b flag -.El \" Ends the list -.Pp -.\" .Sh ENVIRONMENT \" May not be needed -.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 -.\" .It Ev ENV_VAR_1 -.\" Description of ENV_VAR_1 -.\" .It Ev ENV_VAR_2 -.\" Description of ENV_VAR_2 -.\" .El -.Sh FILES \" File used or created by the topic of the man page -.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact -.It Pa /usr/share/file_name -FILE_1 description -.It Pa /Users/joeuser/Library/really_long_file_name -FILE_2 description -.El \" Ends the list -.\" .Sh DIAGNOSTICS \" May not be needed -.\" .Bl -diag -.\" .It Diagnostic Tag -.\" Diagnostic informtion here. -.\" .It Diagnostic Tag -.\" Diagnostic informtion here. -.\" .El -.Sh SEE ALSO -.\" List links in ascending order by section, alphabetically within a section. -.\" Please do not reference files that do not exist without filing a bug report -.Xr a 1 , -.Xr b 1 , -.Xr c 1 , -.Xr a 2 , -.Xr b 2 , -.Xr a 3 , -.Xr b 3 -.\" .Sh BUGS \" Document known, unremedied bugs -.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/360Daemon/360Daemon.m b/360Daemon/360Daemon.m index abbb1d2..ffe2145 100644 --- a/360Daemon/360Daemon.m +++ b/360Daemon/360Daemon.m @@ -21,33 +21,34 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #import -#import -#import -#import -#import +#include +#include +#include +#include #include -#import -#include "ControlPrefs.h" +#include +#import "ControlPrefs.h" +#import "DaemonLEDs.h" #define CHECK_SHOWAGAIN @"Do not show this message again" #define INSTALL_PATH @"/Library/Application Support/MICE/360Daemon" #define RESOURCE_PATH INSTALL_PATH @"/Resources" -mach_port_t masterPort; -IONotificationPortRef notifyPort; -CFRunLoopSourceRef notifySource; -io_iterator_t onIteratorWired; -io_iterator_t onIteratorWireless; -io_iterator_t onIteratorOther; -io_iterator_t offIteratorWired; -io_iterator_t offIteratorWireless; -BOOL foundWirelessReceiver; -NSString *leds[4]; +static mach_port_t masterPort; +static IONotificationPortRef notifyPort; +static CFRunLoopSourceRef notifySource; +static io_iterator_t onIteratorWired; +static io_iterator_t onIteratorWireless; +static io_iterator_t onIteratorOther; +static io_iterator_t offIteratorWired; +static io_iterator_t offIteratorWireless; +static BOOL foundWirelessReceiver; +static DaemonLEDs *leds; -CFUserNotificationRef activeAlert = nil; -CFRunLoopSourceRef activeAlertSource; -int activeAlertIndex; +static CFUserNotificationRef activeAlert = nil; +static CFRunLoopSourceRef activeAlertSource; +static NSInteger activeAlertIndex; enum { kaPlugNCharge = 0, @@ -62,37 +63,27 @@ static void releaseAlert(void) CFRunLoopRemoveSource(CFRunLoopGetCurrent(), activeAlertSource, kCFRunLoopCommonModes); CFRelease(activeAlertSource); CFRelease(activeAlert); - activeAlertSource = nil; - activeAlert = nil; + activeAlertSource = NULL; + activeAlert = NULL; } static void callbackAlert(CFUserNotificationRef userNotification, CFOptionFlags responseFlags) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - +@autoreleasepool { if (responseFlags & CFUserNotificationCheckBoxChecked(0)) SetAlertDisabled(activeAlertIndex); releaseAlert(); - [pool release]; +} } -static void ShowAlert(int index) +static void ShowAlert(NSInteger index) { SInt32 error; - NSArray *checkBoxes = [NSArray arrayWithObjects:CHECK_SHOWAGAIN, nil]; - NSArray *dictKeys = [NSArray arrayWithObjects: - (NSString*)kCFUserNotificationAlertHeaderKey, - (NSString*)kCFUserNotificationAlertMessageKey, - (NSString*)kCFUserNotificationCheckBoxTitlesKey, - (NSString*)kCFUserNotificationIconURLKey, - nil]; - NSArray *dictValues = [NSArray arrayWithObjects: - @"XBox 360 Controller Driver", - alertStrings[index], - checkBoxes, - [NSURL fileURLWithPath:RESOURCE_PATH @"/Alert.tif"], - nil]; - NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:dictValues forKeys:dictKeys]; + NSArray *checkBoxes = @[NSLocalizedString(CHECK_SHOWAGAIN, nil)]; + NSDictionary *dictionary = @{(NSString*)kCFUserNotificationAlertHeaderKey: NSLocalizedString(@"XBox 360 Controller Driver", nil), + (NSString*)kCFUserNotificationAlertMessageKey: NSLocalizedString(alertStrings[index], nil), + (NSString*)kCFUserNotificationCheckBoxTitlesKey: checkBoxes, + (NSString*)kCFUserNotificationIconURLKey: [[NSBundle mainBundle] URLForImageResource:@"Alert"]}; if (AlertDisabled(index)) return; @@ -104,7 +95,7 @@ static void ShowAlert(int index) } activeAlertIndex = index; - activeAlert = CFUserNotificationCreate(kCFAllocatorDefault, 0, kCFUserNotificationPlainAlertLevel, &error, (CFDictionaryRef)dictionary); + activeAlert = CFUserNotificationCreate(kCFAllocatorDefault, 0, kCFUserNotificationPlainAlertLevel, &error, (__bridge CFDictionaryRef)dictionary); activeAlertSource = CFUserNotificationCreateRunLoopSource(kCFAllocatorDefault, activeAlert, callbackAlert, 0); CFRunLoopAddSource(CFRunLoopGetCurrent(), activeAlertSource, kCFRunLoopCommonModes); } @@ -141,31 +132,29 @@ static void ConfigureDevice(io_service_t object) // Supported device - connecting - set settings? static void callbackConnected(void *param,io_iterator_t iterator) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +@autoreleasepool { io_service_t object = 0; while ((object = IOIteratorNext(iterator)) != 0) { - /* - CFStringRef bob = IOObjectCopyClass(object); - NSLog(@"Found %p: %@", object, bob); - CFRelease(bob); - */ +#if 0 + CFStringRef bob = IOObjectCopyClass(object); + NSLog(@"Found %p: %@", object, bob); + CFRelease(bob); +#endif if (IOObjectConformsTo(object, "WirelessHIDDevice") || IOObjectConformsTo(object, "Xbox360ControllerClass")) { - FFDeviceObjectReference forceFeedback; - NSString *serialNumber; + FFDeviceObjectReference forceFeedback = 0; + NSString *serialNumber = GetSerialNumber(object); - serialNumber = GetSerialNumber(object); // Supported device - load settings ConfigController(object, GetController(serialNumber)); // Set LEDs - forceFeedback = 0; if (FFCreateDevice(object, &forceFeedback) != FF_OK) forceFeedback = 0; if (forceFeedback != 0) { - FFEFFESCAPE escape; + FFEFFESCAPE escape = {0}; unsigned char c; int i; @@ -174,12 +163,13 @@ static void callbackConnected(void *param,io_iterator_t iterator) { for (i = 0; i < 4; i++) { - if ((leds[i] == nil) || ([leds[i] caseInsensitiveCompare:serialNumber] == NSOrderedSame)) + if ([leds serialNumberAtLEDIsBlank:i] || ([[leds serialNumberAtLED:i] caseInsensitiveCompare:serialNumber] == NSOrderedSame)) { c = 0x06 + i; - if (leds[i] == nil) - leds[i] = [serialNumber retain]; -// NSLog(@"Added controller with LED %i", i); + if ([leds serialNumberAtLEDIsBlank:i]) { + [leds setLED:i toSerialNumber:serialNumber]; + // NSLog(@"Added controller with LED %i", i); + } break; } } @@ -188,20 +178,18 @@ static void callbackConnected(void *param,io_iterator_t iterator) escape.dwCommand = 0x02; escape.cbInBuffer = sizeof(c); escape.lpvInBuffer = &c; - escape.cbOutBuffer = 0; - escape.lpvOutBuffer = NULL; FFDeviceEscape(forceFeedback, &escape); FFReleaseDevice(forceFeedback); } } else { - CFTypeRef vendorID = IORegistryEntrySearchCFProperty(object,kIOServicePlane,CFSTR("idVendor"),kCFAllocatorDefault,kIORegistryIterateRecursively | kIORegistryIterateParents); - CFTypeRef productID = IORegistryEntrySearchCFProperty(object,kIOServicePlane,CFSTR("idProduct"),kCFAllocatorDefault,kIORegistryIterateRecursively | kIORegistryIterateParents); + NSNumber *vendorID = CFBridgingRelease(IORegistryEntrySearchCFProperty(object,kIOServicePlane,CFSTR("idVendor"),kCFAllocatorDefault,kIORegistryIterateRecursively | kIORegistryIterateParents)); + NSNumber *productID = CFBridgingRelease(IORegistryEntrySearchCFProperty(object,kIOServicePlane,CFSTR("idProduct"),kCFAllocatorDefault,kIORegistryIterateRecursively | kIORegistryIterateParents)); if ((vendorID != NULL) && (productID != NULL)) { - UInt32 idVendor = [((NSNumber*)vendorID) unsignedIntValue]; - UInt32 idProduct = [((NSNumber*)productID) unsignedIntValue]; + UInt32 idVendor = [vendorID unsignedIntValue]; + UInt32 idProduct = [productID unsignedIntValue]; if (idVendor == 0x045e) { // Microsoft @@ -214,63 +202,57 @@ static void callbackConnected(void *param,io_iterator_t iterator) break; case 0x0719: // Microsoft Wireless Gaming Receiver case 0x0291: // Third party Wireless Gaming Receiver - foundWirelessReceiver = TRUE; + foundWirelessReceiver = YES; break; } } } - if (vendorID != NULL) - CFRelease(vendorID); - if (productID != NULL) - CFRelease(productID); } IOObjectRelease(object); } - [pool release]; +} } // Supported device - disconnecting static void callbackDisconnected(void *param, io_iterator_t iterator) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +@autoreleasepool { io_service_t object = 0; NSString *serial; int i; while ((object = IOIteratorNext(iterator)) != 0) { - /* - CFStringRef bob = IOObjectCopyClass(object); - NSLog(@"Lost %p: %@", object, bob); - CFRelease(bob); - */ +#if 0 + CFStringRef bob = IOObjectCopyClass(object); + NSLog(@"Lost %p: %@", object, bob); + CFRelease(bob); +#endif serial = GetSerialNumber(object); if (serial != nil) { for (i = 0; i < 4; i++) { - if (leds[i] == nil) + if ([leds serialNumberAtLEDIsBlank:i]) continue; - if ([leds[i] caseInsensitiveCompare:serial] == NSOrderedSame) + if ([[leds serialNumberAtLED:i] caseInsensitiveCompare:serial] == NSOrderedSame) { - [leds[i] release]; - leds[i] = nil; -// NSLog(@"Removed controller with LED %i", i); + [leds clearSerialNumberAtLED:i]; + // NSLog(@"Removed controller with LED %i", i); } } } IOObjectRelease(object); } - [pool release]; +} } // Entry point int main (int argc, const char * argv[]) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - - foundWirelessReceiver = FALSE; - memset(leds, 0, sizeof(leds)); +@autoreleasepool { + foundWirelessReceiver = NO; + leds = [[DaemonLEDs alloc] init]; // Get master port, for accessing I/O Kit IOMasterPort(MACH_PORT_NULL,&masterPort); // Set up notification of USB device addition/removal @@ -278,15 +260,15 @@ int main (int argc, const char * argv[]) notifySource=IONotificationPortGetRunLoopSource(notifyPort); CFRunLoopAddSource(CFRunLoopGetCurrent(),notifySource,kCFRunLoopCommonModes); // Start listening - // USB devices + // USB devices IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching(kIOUSBDeviceClassName), callbackConnected, NULL, &onIteratorOther); callbackConnected(NULL, onIteratorOther); - // Wired 360 devices + // Wired 360 devices IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("Xbox360ControllerClass"), callbackConnected, NULL, &onIteratorWired); callbackConnected(NULL, onIteratorWired); IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, IOServiceMatching("Xbox360ControllerClass"), callbackDisconnected, NULL, &offIteratorWired); callbackDisconnected(NULL, offIteratorWired); - // Wireless 360 devices + // Wireless 360 devices IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("WirelessHIDDevice"), callbackConnected, NULL, &onIteratorWireless); callbackConnected(NULL, onIteratorWireless); IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, IOServiceMatching("WirelessHIDDevice"), callbackDisconnected, NULL, &offIteratorWireless); @@ -303,6 +285,6 @@ int main (int argc, const char * argv[]) CFRunLoopSourceInvalidate(notifySource); IONotificationPortDestroy(notifyPort); // End - [pool release]; +} return 0; } diff --git a/360Daemon/360Daemon.xcodeproj/project.pbxproj b/360Daemon/360Daemon.xcodeproj/project.pbxproj deleted file mode 100644 index c323444..0000000 --- a/360Daemon/360Daemon.xcodeproj/project.pbxproj +++ /dev/null @@ -1,248 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 45; - objects = { - -/* Begin PBXBuildFile section */ - 3B7905000CE3F6A400ACB699 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7904FF0CE3F6A400ACB699 /* ForceFeedback.framework */; }; - 3B7A8E2C0CE14E38005BB45B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7A8E2B0CE14E38005BB45B /* IOKit.framework */; }; - 3B8698090CE2903100283CEC /* ControlPrefs.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B8698080CE2903100283CEC /* ControlPrefs.m */; }; - 8DD76F9A0486AA7600D96B5E /* 360Daemon.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* 360Daemon.m */; settings = {ATTRIBUTES = (); }; }; - 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; - 8DD76F9F0486AA7600D96B5E /* 360Daemon.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* 360Daemon.1 */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 8; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - 8DD76F9F0486AA7600D96B5E /* 360Daemon.1 in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 08FB7796FE84155DC02AAC07 /* 360Daemon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = 360Daemon.m; sourceTree = ""; }; - 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32A70AAB03705E1F00C91783 /* 360Daemon_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 360Daemon_Prefix.pch; sourceTree = ""; }; - 3B7904D50CE3F13700ACB699 /* Alert.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Alert.tif; sourceTree = ""; }; - 3B7904FF0CE3F6A400ACB699 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 3B7A8E2B0CE14E38005BB45B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 3B8698070CE2903100283CEC /* ControlPrefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ControlPrefs.h; sourceTree = ""; }; - 3B8698080CE2903100283CEC /* ControlPrefs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ControlPrefs.m; sourceTree = ""; }; - 3BBB7EED16C387C600BC7827 /* com.mice.360Daemon.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = com.mice.360Daemon.plist; sourceTree = ""; }; - 8DD76FA10486AA7600D96B5E /* 360Daemon */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = 360Daemon; sourceTree = BUILT_PRODUCTS_DIR; }; - C6859EA3029092ED04C91782 /* 360Daemon.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = 360Daemon.1; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, - 3B7A8E2C0CE14E38005BB45B /* IOKit.framework in Frameworks */, - 3B7905000CE3F6A400ACB699 /* ForceFeedback.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 08FB7794FE84155DC02AAC07 /* 360Daemon */ = { - isa = PBXGroup; - children = ( - 08FB7795FE84155DC02AAC07 /* Source */, - C6859EA2029092E104C91782 /* Documentation */, - 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, - 1AB674ADFE9D54B511CA2CBB /* Products */, - ); - name = 360Daemon; - sourceTree = ""; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 3B7904D50CE3F13700ACB699 /* Alert.tif */, - 3B8698070CE2903100283CEC /* ControlPrefs.h */, - 3B8698080CE2903100283CEC /* ControlPrefs.m */, - 32A70AAB03705E1F00C91783 /* 360Daemon_Prefix.pch */, - 08FB7796FE84155DC02AAC07 /* 360Daemon.m */, - 3BBB7EED16C387C600BC7827 /* com.mice.360Daemon.plist */, - ); - name = Source; - sourceTree = ""; - }; - 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 3B7904FF0CE3F6A400ACB699 /* ForceFeedback.framework */, - 3B7A8E2B0CE14E38005BB45B /* IOKit.framework */, - 08FB779EFE84155DC02AAC07 /* Foundation.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8DD76FA10486AA7600D96B5E /* 360Daemon */, - ); - name = Products; - sourceTree = ""; - }; - C6859EA2029092E104C91782 /* Documentation */ = { - isa = PBXGroup; - children = ( - C6859EA3029092ED04C91782 /* 360Daemon.1 */, - ); - name = Documentation; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8DD76F960486AA7600D96B5E /* 360Daemon */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "360Daemon" */; - buildPhases = ( - 8DD76F990486AA7600D96B5E /* Sources */, - 8DD76F9B0486AA7600D96B5E /* Frameworks */, - 8DD76F9E0486AA7600D96B5E /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = 360Daemon; - productInstallPath = "$(HOME)/bin"; - productName = 360Daemon; - productReference = 8DD76FA10486AA7600D96B5E /* 360Daemon */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "360Daemon" */; - compatibilityVersion = "Xcode 2.4"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* 360Daemon */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DD76F960486AA7600D96B5E /* 360Daemon */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 8DD76F990486AA7600D96B5E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DD76F9A0486AA7600D96B5E /* 360Daemon.m in Sources */, - 3B8698090CE2903100283CEC /* ControlPrefs.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1DEB927508733DD40010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = 360Daemon_Prefix.pch; - INSTALL_PATH = "$(HOME)/bin"; - PRODUCT_NAME = 360Daemon; - SDKROOT = ""; - ZERO_LINK = YES; - }; - name = Debug; - }; - 1DEB927608733DD40010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = 360Daemon_Prefix.pch; - INSTALL_PATH = "$(HOME)/bin"; - PRODUCT_NAME = 360Daemon; - }; - name = Release; - }; - 1DEB927908733DD40010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Debug; - }; - 1DEB927A08733DD40010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "360Daemon" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB927508733DD40010E9CD /* Debug */, - 1DEB927608733DD40010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "360Daemon" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB927908733DD40010E9CD /* Debug */, - 1DEB927A08733DD40010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/360Daemon/360DaemonApp-Info.plist b/360Daemon/360DaemonApp-Info.plist new file mode 100644 index 0000000..a522ed4 --- /dev/null +++ b/360Daemon/360DaemonApp-Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.mice.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${CURRENT_PROJECT_VERSION} + CFBundleSignature + 360D + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + LSUIElement + + NSHumanReadableCopyright + Copyright © 2014 C.W. Betts. All rights reserved. + + diff --git a/360Daemon/360Daemon_Prefix.pch b/360Daemon/360DaemonApp-Prefix.pch similarity index 76% rename from 360Daemon/360Daemon_Prefix.pch rename to 360Daemon/360DaemonApp-Prefix.pch index d0b6018..a992e9b 100644 --- a/360Daemon/360Daemon_Prefix.pch +++ b/360Daemon/360DaemonApp-Prefix.pch @@ -3,5 +3,5 @@ // #ifdef __OBJC__ - #import + #import #endif diff --git a/360Daemon/ControlPrefs.h b/360Daemon/ControlPrefs.h index d3ec031..a7481a7 100644 --- a/360Daemon/ControlPrefs.h +++ b/360Daemon/ControlPrefs.h @@ -29,8 +29,8 @@ #define D_KNOWNDEV @"KnownDevices" // Daemon's own settings -void SetAlertDisabled(int index); -BOOL AlertDisabled(int index); +void SetAlertDisabled(NSInteger index); +BOOL AlertDisabled(NSInteger index); // Controller settings void SetController(NSString *serial, NSDictionary *data); @@ -38,7 +38,7 @@ NSDictionary* GetController(NSString *serial); // Configuration settings void SetKnownDevices(NSDictionary *devices); -NSDictionary* GetKnownDevices(void); +NSDictionary* GetKnownDevices(); // Utility functions NSString* GetSerialNumber(io_service_t device); diff --git a/360Daemon/ControlPrefs.m b/360Daemon/ControlPrefs.m index fe17330..3cb4f82 100644 --- a/360Daemon/ControlPrefs.m +++ b/360Daemon/ControlPrefs.m @@ -22,69 +22,60 @@ */ #import "ControlPrefs.h" -void SetAlertDisabled(int index) +void SetAlertDisabled(NSInteger index) { - NSString *prop; - NSNumber *value; + NSString *prop = [NSString stringWithFormat:@"%@%li", D_SHOWONCE, (long)index]; - prop = [NSString stringWithFormat:@"%@%i", D_SHOWONCE, index]; - value = [NSNumber numberWithBool:TRUE]; - CFPreferencesSetValue((CFStringRef)prop, value, DOM_DAEMON, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); - CFPreferencesSynchronize((CFStringRef)DOM_DAEMON, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); + CFPreferencesSetValue((__bridge CFStringRef)prop, kCFBooleanTrue, DOM_DAEMON, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); + CFPreferencesSynchronize(DOM_DAEMON, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); } -BOOL AlertDisabled(int index) +BOOL AlertDisabled(NSInteger index) { - NSString *prop; - BOOL result; - CFPropertyListRef value; + NSString *prop = [NSString stringWithFormat:@"%@%li", D_SHOWONCE, (long)index]; + BOOL result = NO; + CFPropertyListRef value = CFPreferencesCopyValue((__bridge CFStringRef)prop, DOM_DAEMON, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); - result = FALSE; - prop = [NSString stringWithFormat:@"%@%i", D_SHOWONCE, index]; - value = CFPreferencesCopyValue((CFStringRef)prop, DOM_DAEMON, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost); if (value != NULL) { - result = [((NSNumber*)value) boolValue]; - CFRelease(value); + result = [CFBridgingRelease(value) boolValue]; } return result; } void SetController(NSString *serial, NSDictionary *data) { - CFPreferencesSetValue((CFStringRef)serial, data, DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); + CFPreferencesSetValue((__bridge CFStringRef)serial, (__bridge CFPropertyListRef)(data), DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); CFPreferencesSynchronize(DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); } NSDictionary* GetController(NSString *serial) { CFPropertyListRef value; - CFPreferencesSynchronize(DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); - value = CFPreferencesCopyValue((CFStringRef)serial, DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); - return [((NSDictionary*)value) autorelease]; + value = CFPreferencesCopyValue((__bridge CFStringRef)serial, DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); + return CFBridgingRelease(value); } NSString* GetSerialNumber(io_service_t device) { - CFTypeRef value; + CFTypeRef value = IORegistryEntrySearchCFProperty(device, kIOServicePlane, CFSTR("USB Serial Number"), kCFAllocatorDefault, kIORegistryIterateRecursively); - value = IORegistryEntrySearchCFProperty(device, kIOServicePlane, CFSTR("USB Serial Number"), kCFAllocatorDefault, kIORegistryIterateRecursively); if (value == NULL) value = IORegistryEntrySearchCFProperty(device, kIOServicePlane, CFSTR("SerialNumber"), kCFAllocatorDefault, kIORegistryIterateRecursively); - return [((NSString*)value) autorelease]; + return CFBridgingRelease(value); } void ConfigController(io_service_t device, NSDictionary *config) { - IORegistryEntrySetCFProperties(device, config); + IORegistryEntrySetCFProperties(device, (__bridge CFTypeRef)(config)); } void SetKnownDevices(NSDictionary *devices) { // Setting the dictionary should work? NSData *data = [NSKeyedArchiver archivedDataWithRootObject:devices]; - CFPreferencesSetValue((CFStringRef)D_KNOWNDEV, data, DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); + CFPreferencesSetValue((CFStringRef)D_KNOWNDEV, (__bridge CFPropertyListRef)(data), DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); CFPreferencesSynchronize(DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); } @@ -95,7 +86,7 @@ void SetKnownDevices(NSDictionary *devices) CFPreferencesSynchronize(DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); value = CFPreferencesCopyValue((CFStringRef)D_KNOWNDEV, DOM_CONTROLLERS, kCFPreferencesAnyUser, kCFPreferencesCurrentHost); - data = [(NSData*)value autorelease]; + data = CFBridgingRelease(value); if (data == nil) return nil; return [NSKeyedUnarchiver unarchiveObjectWithData:data]; diff --git a/360Daemon/DaemonLEDs.h b/360Daemon/DaemonLEDs.h new file mode 100644 index 0000000..37eea0e --- /dev/null +++ b/360Daemon/DaemonLEDs.h @@ -0,0 +1,20 @@ +// +// DaemonLEDs.h +// 360 Driver +// +// Created by C.W. Betts on 4/25/14. +// Copyright (c) 2014 GitHub. All rights reserved. +// + +#import + +@interface DaemonLEDs : NSObject +- (void)setLED:(int)theLED toSerialNumber:(NSString*)serialNum; +- (NSString *)serialNumberAtLED:(int)theLED; +- (BOOL)serialNumberAtLEDIsBlank:(int)theLED; +- (void)clearSerialNumberAtLED:(int)theLED; +#if 0 +- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx; +- (id)objectAtIndexedSubscript:(NSUInteger)idx; +#endif +@end diff --git a/360Daemon/DaemonLEDs.m b/360Daemon/DaemonLEDs.m new file mode 100644 index 0000000..a9b5fd2 --- /dev/null +++ b/360Daemon/DaemonLEDs.m @@ -0,0 +1,118 @@ +// +// DaemonLEDs.m +// 360 Driver +// +// Created by C.W. Betts on 4/25/14. +// Copyright (c) 2014 GitHub. All rights reserved. +// + +#import "DaemonLEDs.h" + +@interface DaemonLEDs () +@property (copy) NSString *theLED0; +@property (copy) NSString *theLED1; +@property (copy) NSString *theLED2; +@property (copy) NSString *theLED3; +@end + +@implementation DaemonLEDs + +- (void)setLED:(int)theLED toSerialNumber:(NSString*)serialNum +{ + switch (theLED) { + case 0: + self.theLED0 = serialNum; + break; + + case 1: + self.theLED1 = serialNum; + break; + + case 2: + self.theLED2 = serialNum; + break; + + case 3: + self.theLED3 = serialNum; + break; + + default: + break; + } +} + +- (NSString *)serialNumberAtLED:(int)theLED +{ + switch (theLED) { + case 0: + return self.theLED0; + break; + + case 1: + return self.theLED1; + break; + + case 2: + return self.theLED2; + break; + + case 3: + return self.theLED3; + break; + + default: + return @""; + break; + } +} + +- (BOOL)serialNumberAtLEDIsBlank:(int)theLED +{ + switch (theLED) { + case 0: + return self.theLED0 == nil; + break; + + case 1: + return self.theLED1 == nil; + break; + + case 2: + return self.theLED2 == nil; + break; + + case 3: + return self.theLED3 == nil; + break; + + default: + return NO; + break; + } +} + +- (void)clearSerialNumberAtLED:(int)theLED +{ + switch (theLED) { + case 0: + self.theLED0 = nil; + break; + + case 1: + self.theLED1 = nil; + break; + + case 2: + self.theLED2 = nil; + break; + + case 3: + self.theLED3 = nil; + break; + + default: + break; + } +} + +@end diff --git a/360Daemon/FoundationTool.pbproj/project.pbxproj b/360Daemon/FoundationTool.pbproj/project.pbxproj deleted file mode 100644 index 728d424..0000000 --- a/360Daemon/FoundationTool.pbproj/project.pbxproj +++ /dev/null @@ -1,259 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - 014CEA4F0018CE4811CA2923 = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - ZERO_LINK = YES; - }; - isa = PBXBuildStyle; - name = Development; - }; - 014CEA500018CE4811CA2923 = { - buildRules = ( - ); - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - ZERO_LINK = NO; - }; - isa = PBXBuildStyle; - name = Deployment; - }; -//010 -//011 -//012 -//013 -//014 -//080 -//081 -//082 -//083 -//084 - 08FB7793FE84155DC02AAC07 = { - buildSettings = { - }; - buildStyles = ( - 014CEA4F0018CE4811CA2923, - 014CEA500018CE4811CA2923, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = 08FB7794FE84155DC02AAC07; - projectDirPath = ""; - targets = ( - 8DD76F960486AA7600D96B5E, - ); - }; - 08FB7794FE84155DC02AAC07 = { - children = ( - 08FB7795FE84155DC02AAC07, - C6859EA2029092E104C91782, - 08FB779DFE84155DC02AAC07, - 1AB674ADFE9D54B511CA2CBB, - ); - isa = PBXGroup; - name = "«PROJECTNAME»"; - refType = 4; - sourceTree = ""; - }; - 08FB7795FE84155DC02AAC07 = { - children = ( - 32A70AAB03705E1F00C91783, - 08FB7796FE84155DC02AAC07, - ); - isa = PBXGroup; - name = Source; - refType = 4; - sourceTree = ""; - }; - 08FB7796FE84155DC02AAC07 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.objc; - path = "«PROJECTNAME».m"; - refType = 4; - sourceTree = ""; - }; - 08FB779DFE84155DC02AAC07 = { - children = ( - 08FB779EFE84155DC02AAC07, - ); - isa = PBXGroup; - name = "External Frameworks and Libraries"; - refType = 4; - sourceTree = ""; - }; - 08FB779EFE84155DC02AAC07 = { - fallbackIsa = PBXFileReference; - isa = PBXFrameworkReference; - lastKnownFileType = wrapper.framework; - name = Foundation.framework; - path = /System/Library/Frameworks/Foundation.framework; - refType = 0; - sourceTree = ""; - }; -//080 -//081 -//082 -//083 -//084 -//1A0 -//1A1 -//1A2 -//1A3 -//1A4 - 1AB674ADFE9D54B511CA2CBB = { - children = ( - 8DD76FA10486AA7600D96B5E, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = ""; - }; -//1A0 -//1A1 -//1A2 -//1A3 -//1A4 -//320 -//321 -//322 -//323 -//324 - 32A70AAB03705E1F00C91783 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = file; - path = "«PROJECTNAME»_Prefix.pch"; - refType = 4; - sourceTree = ""; - }; -//320 -//321 -//322 -//323 -//324 -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 - 8DD76F960486AA7600D96B5E = { - buildPhases = ( - 8DD76F990486AA7600D96B5E, - 8DD76F9B0486AA7600D96B5E, - 8DD76F9E0486AA7600D96B5E, - ); - buildRules = ( - ); - buildSettings = { - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "«PROJECTNAME»_Prefix.pch"; - INSTALL_PATH = "$(HOME)/bin"; - PRODUCT_NAME = "«PROJECTNAME»"; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = "«PROJECTNAME»"; - productInstallPath = "$(HOME)/bin"; - productName = "«PROJECTNAME»"; - productReference = 8DD76FA10486AA7600D96B5E; - productType = "com.apple.product-type.tool"; - }; - 8DD76F990486AA7600D96B5E = { - buildActionMask = 2147483647; - files = ( - 8DD76F9A0486AA7600D96B5E, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8DD76F9A0486AA7600D96B5E = { - fileRef = 08FB7796FE84155DC02AAC07; - isa = PBXBuildFile; - settings = { - ATTRIBUTES = ( - ); - }; - }; - 8DD76F9B0486AA7600D96B5E = { - buildActionMask = 2147483647; - files = ( - 8DD76F9C0486AA7600D96B5E, - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 8DD76F9C0486AA7600D96B5E = { - fileRef = 08FB779EFE84155DC02AAC07; - isa = PBXBuildFile; - settings = { - }; - }; - 8DD76F9E0486AA7600D96B5E = { - buildActionMask = 8; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - 8DD76F9F0486AA7600D96B5E, - ); - isa = PBXCopyFilesBuildPhase; - runOnlyForDeploymentPostprocessing = 1; - }; - 8DD76F9F0486AA7600D96B5E = { - fileRef = C6859EA3029092ED04C91782; - isa = PBXBuildFile; - settings = { - }; - }; - 8DD76FA10486AA7600D96B5E = { - explicitFileType = "compiled.mach-o.executable"; - includeInIndex = 0; - isa = PBXFileReference; - path = "«PROJECTNAME»"; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 -//C60 -//C61 -//C62 -//C63 -//C64 - C6859EA2029092E104C91782 = { - children = ( - C6859EA3029092ED04C91782, - ); - isa = PBXGroup; - name = Documentation; - refType = 4; - sourceTree = ""; - }; - C6859EA3029092ED04C91782 = { - isa = PBXFileReference; - lastKnownFileType = file; - path = "«PROJECTNAME».1"; - refType = 4; - sourceTree = ""; - }; - }; - rootObject = 08FB7793FE84155DC02AAC07; -} diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-1024.png b/360Daemon/Images.xcassets/360Control.appiconset/360-1024.png new file mode 100644 index 0000000..208a61c Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-1024.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-128.png b/360Daemon/Images.xcassets/360Control.appiconset/360-128.png new file mode 100644 index 0000000..926cff6 Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-128.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-16.png b/360Daemon/Images.xcassets/360Control.appiconset/360-16.png new file mode 100644 index 0000000..73b7da3 Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-16.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-256.png b/360Daemon/Images.xcassets/360Control.appiconset/360-256.png new file mode 100644 index 0000000..4d357a7 Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-256.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-32.png b/360Daemon/Images.xcassets/360Control.appiconset/360-32.png new file mode 100644 index 0000000..c7315e8 Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-32.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-512.png b/360Daemon/Images.xcassets/360Control.appiconset/360-512.png new file mode 100644 index 0000000..ff59c24 Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-512.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/360-64.png b/360Daemon/Images.xcassets/360Control.appiconset/360-64.png new file mode 100644 index 0000000..d61a2f0 Binary files /dev/null and b/360Daemon/Images.xcassets/360Control.appiconset/360-64.png differ diff --git a/360Daemon/Images.xcassets/360Control.appiconset/Contents.json b/360Daemon/Images.xcassets/360Control.appiconset/Contents.json new file mode 100644 index 0000000..b60be38 --- /dev/null +++ b/360Daemon/Images.xcassets/360Control.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "360-16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "360-32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "360-32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "360-64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "360-128.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "filename" : "360-256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "360-256.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "filename" : "360-512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "360-512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "360-1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/360Daemon/com.mice.360Daemon.plist b/360Daemon/com.mice.360Daemon.plist index a0f3a82..386f271 100644 --- a/360Daemon/com.mice.360Daemon.plist +++ b/360Daemon/com.mice.360Daemon.plist @@ -6,7 +6,7 @@ ProgramArguments - /Library/Application Support/MICE/360Daemon/360Daemon + /Library/Application Support/MICE/360Daemon.app/Contents/MacOS/360Daemon KeepAlive diff --git a/360Daemon/en.lproj/InfoPlist.strings b/360Daemon/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/360Daemon/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/360Daemon/en.lproj/Localizable.strings b/360Daemon/en.lproj/Localizable.strings new file mode 100644 index 0000000..864e6ed --- /dev/null +++ b/360Daemon/en.lproj/Localizable.strings @@ -0,0 +1,11 @@ +/* + Localizable.strings + 360 Driver + + Created by C.W. Betts on 2/28/14. + Copyright (c) 2014 GitHub. All rights reserved. +*/ + +"Do not show this message again" = "Do not show this message again"; +"You have attached a Microsoft Play & Charge cable for your XBox 360 Wireless Controller. While this cable will allow you to charge your wireless controller, you will require the Microsoft Wireless Gaming Receiver for Windows to use your wireless controller in Mac OS X!" = "You have attached a Microsoft Play & Charge cable for your XBox 360 Wireless Controller. While this cable will allow you to charge your wireless controller, you will require the Microsoft Wireless Gaming Receiver for Windows to use your wireless controller in Mac OS X!"; +"XBox 360 Controller Driver" = "XBox 360 Controller Driver"; diff --git a/360Driver.xcworkspace/contents.xcworkspacedata b/360Driver.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..be6e1ae --- /dev/null +++ b/360Driver.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/DriverTool/DriverTool.1 b/DriverTool/DriverTool.1 deleted file mode 100644 index f5b4c86..0000000 --- a/DriverTool/DriverTool.1 +++ /dev/null @@ -1,79 +0,0 @@ -.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples. -.\"See Also: -.\"man mdoc.samples for a complete listing of options -.\"man mdoc for the short list of editing options -.\"/usr/share/misc/mdoc.template -.Dd 8/05/2011 \" DATE -.Dt DriverTool 1 \" Program name and manual section number -.Os Darwin -.Sh NAME \" Section Header - required - don't modify -.Nm DriverTool, -.\" The following lines are read in generating the apropos(man -k) database. Use only key -.\" words here as the database is built based on the words here and in the .ND line. -.Nm Other_name_for_same_program(), -.Nm Yet another name for the same program. -.\" Use .Nm macro to designate other names for the documented program. -.Nd This line parsed for whatis database. -.Sh SYNOPSIS \" Section Header - required - don't modify -.Nm -.Op Fl abcd \" [-abcd] -.Op Fl a Ar path \" [-a path] -.Op Ar file \" [file] -.Op Ar \" [file ...] -.Ar arg0 \" Underlined argument - use .Ar anywhere to underline -arg2 ... \" Arguments -.Sh DESCRIPTION \" Section Header - required - don't modify -Use the .Nm macro to refer to your program throughout the man page like such: -.Nm -Underlining is accomplished with the .Ar macro like this: -.Ar underlined text . -.Pp \" Inserts a space -A list of items with descriptions: -.Bl -tag -width -indent \" Begins a tagged list -.It item a \" Each item preceded by .It macro -Description of item a -.It item b -Description of item b -.El \" Ends the list -.Pp -A list of flags and their descriptions: -.Bl -tag -width -indent \" Differs from above in tag removed -.It Fl a \"-a flag as a list item -Description of -a flag -.It Fl b -Description of -b flag -.El \" Ends the list -.Pp -.\" .Sh ENVIRONMENT \" May not be needed -.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1 -.\" .It Ev ENV_VAR_1 -.\" Description of ENV_VAR_1 -.\" .It Ev ENV_VAR_2 -.\" Description of ENV_VAR_2 -.\" .El -.Sh FILES \" File used or created by the topic of the man page -.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact -.It Pa /usr/share/file_name -FILE_1 description -.It Pa /Users/joeuser/Library/really_long_file_name -FILE_2 description -.El \" Ends the list -.\" .Sh DIAGNOSTICS \" May not be needed -.\" .Bl -diag -.\" .It Diagnostic Tag -.\" Diagnostic informtion here. -.\" .It Diagnostic Tag -.\" Diagnostic informtion here. -.\" .El -.Sh SEE ALSO -.\" List links in ascending order by section, alphabetically within a section. -.\" Please do not reference files that do not exist without filing a bug report -.Xr a 1 , -.Xr b 1 , -.Xr c 1 , -.Xr a 2 , -.Xr b 2 , -.Xr a 3 , -.Xr b 3 -.\" .Sh BUGS \" Document known, unremedied bugs -.\" .Sh HISTORY \" Document history if command behaves in a unique manner \ No newline at end of file diff --git a/DriverTool/DriverTool.m b/DriverTool/DriverTool.m index 6dc6a29..94cdde3 100644 --- a/DriverTool/DriverTool.m +++ b/DriverTool/DriverTool.m @@ -22,77 +22,66 @@ */ #import -#define DRIVER_NAME @"360Controller.kext" +#define DRIVER_NAME @"360Controller.kext" static NSDictionary *infoPlistAttributes = nil; -static NSString* GetDriverDirectory(void) +static inline NSString* GetDriverDirectory(void) { NSArray *data = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSSystemDomainMask, YES); - return [[data objectAtIndex:0] stringByAppendingPathComponent:@"Extensions"]; + return [data[0] stringByAppendingPathComponent:@"Extensions"]; } static NSString* GetDriverConfigPath(NSString *driver) { NSString *root = GetDriverDirectory(); - NSString *driverPath = [root stringByAppendingPathComponent:driver]; - NSString *contents = [driverPath stringByAppendingPathComponent:@"Contents"]; - return [contents stringByAppendingPathComponent:@"Info.plist"]; + NSArray *pathComp = [root pathComponents]; + pathComp = [pathComp arrayByAddingObjectsFromArray:@[driver, @"Contents", @"Info.plist"]]; + return [NSString pathWithComponents:pathComp]; } -static id ReadDriverConfig(NSString *driver) +static NSDictionary *ReadDriverConfig(NSString *driver) { - NSString *filename; - NSError *error = nil; + NSString *filename = GetDriverConfigPath(driver); + NSError *error; NSData *data; - NSDictionary *config; - filename = GetDriverConfigPath(driver); - infoPlistAttributes = [[[NSFileManager defaultManager] attributesOfItemAtPath:filename error:&error] retain]; + infoPlistAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filename error:&error]; if (infoPlistAttributes == nil) { NSLog(@"Warning: Failed to read attributes of '%@': %@", filename, error); } data = [NSData dataWithContentsOfFile:filename]; - config = [NSPropertyListSerialization propertyListFromData:data mutabilityOption:0 format:NULL errorDescription:NULL]; - return config; + return [NSPropertyListSerialization propertyListFromData:data mutabilityOption:0 format:NULL errorDescription:NULL]; } static void WriteDriverConfig(NSString *driver, id config) { - NSString *filename; - NSString *errorString; - NSData *data; + NSString *filename = GetDriverConfigPath(driver); + NSError *error; + NSData *data = [NSPropertyListSerialization dataWithPropertyList:config format:NSPropertyListXMLFormat_v1_0 options:0 error:&error]; - filename = GetDriverConfigPath(driver); - errorString = nil; - data = [NSPropertyListSerialization dataFromPropertyList:config format:NSPropertyListXMLFormat_v1_0 errorDescription:&errorString]; if (data == nil) - NSLog(@"Error writing config for driver: %@", errorString); - [errorString release]; + NSLog(@"Error writing config for driver: %@", error); + if (![data writeToFile:filename atomically:NO]) NSLog(@"Failed to write file!"); - if (infoPlistAttributes != nil) - { - NSError *error = nil; - if (![[NSFileManager defaultManager] setAttributes:infoPlistAttributes ofItemAtPath:filename error:&error]) - { - NSLog(@"Error setting attributes on '%@': %@", - filename, error); + + if (infoPlistAttributes != nil) { + if (![[NSFileManager defaultManager] setAttributes:infoPlistAttributes ofItemAtPath:filename error:&error]) { + NSLog(@"Error setting attributes on '%@': %@", filename, error); } } } static void ScrubDevices(NSMutableDictionary *devices) { - NSMutableArray *deviceKeys; + NSMutableArray *deviceKeys = [[NSMutableArray alloc] initWithCapacity:10]; - deviceKeys = [NSMutableArray arrayWithCapacity:10]; - for (NSString *key in [devices allKeys]) - { - NSDictionary *device = [devices objectForKey:key]; - if ([(NSString*)[device objectForKey:@"IOClass"] compare:@"Xbox360Peripheral"] == NSOrderedSame) + for (NSString *key in devices) { + NSDictionary *device = devices[key]; + if ([(NSString*)device[@"IOClass"] compare:@"Xbox360Peripheral"] == NSOrderedSame) [deviceKeys addObject:key]; } [devices removeObjectsForKeys:deviceKeys]; @@ -100,50 +89,36 @@ static void ScrubDevices(NSMutableDictionary *devices) static id MakeMutableCopy(id object) { - return [(id)CFPropertyListCreateDeepCopy( - kCFAllocatorDefault, - (CFTypeRef)object, - kCFPropertyListMutableContainers) autorelease]; + return CFBridgingRelease(CFPropertyListCreateDeepCopy(kCFAllocatorDefault, + (CFTypeRef)object, + kCFPropertyListMutableContainers)); } static void AddDevice(NSMutableDictionary *personalities, NSString *name, int vendor, int product) { - NSMutableDictionary *controller; - - controller = [NSMutableDictionary dictionaryWithCapacity:10]; + NSMutableDictionary *controller = [[NSMutableDictionary alloc] initWithCapacity:10]; - // Standard - [controller setObject:@"com.mice.driver.Xbox360Controller" - forKey:@"CFBundleIdentifier"]; - [controller setObject:[NSDictionary dictionaryWithObject:@"360Controller.kext/Contents/PlugIns/Feedback360.plugin" - forKey:@"F4545CE5-BF5B-11D6-A4BB-0003933E3E3E"] - forKey:@"IOCFPlugInTypes"]; - [controller setObject:@"Xbox360Peripheral" - forKey:@"IOClass"]; - [controller setObject:@"IOUSBDevice" - forKey:@"IOProviderClass"]; - [controller setObject:[NSNumber numberWithInt:65535] - forKey:@"IOKitDebug"]; + // Standard + controller[@"CFBundleIdentifier"] = @"com.mice.driver.Xbox360Controller"; + controller[@"IOCFPlugInTypes"] = @{@"F4545CE5-BF5B-11D6-A4BB-0003933E3E3E": @"360Controller.kext/Contents/PlugIns/Feedback360.plugin"}; + controller[@"IOClass"] = @"Xbox360Peripheral"; + controller[@"IOProviderClass"] = @"IOUSBDevice"; + controller[@"IOKitDebug"] = @65535; // Device-specific - [controller setObject:[NSNumber numberWithInt:vendor] - forKey:@"idVendor"]; - [controller setObject:[NSNumber numberWithInt:product] - forKey:@"idProduct"]; + controller[@"idVendor"] = @(vendor); + controller[@"idProduct"] = @(product); // Add it to the tree - [personalities setObject:controller - forKey:name]; + personalities[name] = controller; } static void AddDevices(NSMutableDictionary *personalities, int argc, const char *argv[]) { - int i, count; - - count = (argc - 2) / 3; + int i, count = (argc - 2) / 3; for (i = 0; i < count; i++) { - NSString *name = [NSString stringWithCString:argv[(i * 3) + 2] encoding:NSUTF8StringEncoding]; + NSString *name = @(argv[(i * 3) + 2]); int vendor = atoi(argv[(i * 3) + 3]); int product = atoi(argv[(i * 3) + 4]); AddDevice(personalities, name, vendor, product); @@ -151,35 +126,28 @@ static void AddDevices(NSMutableDictionary *personalities, int argc, const char } int main (int argc, const char * argv[]) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - +@autoreleasepool { NSDictionary *config = ReadDriverConfig(DRIVER_NAME); if (argc == 1) { // Print out current types - NSDictionary *types; - NSArray *keys; - - types = [config objectForKey:@"IOKitPersonalities"]; - keys = [types allKeys]; - for (NSString *key in keys) - { - NSDictionary *device = [types objectForKey:key]; - if ([(NSString*)[device objectForKey:@"IOClass"] compare:@"Xbox360Peripheral"] != NSOrderedSame) + NSDictionary *types = config[@"IOKitPersonalities"]; + + for (NSString *key in types) { + NSDictionary *device = types[key]; + if ([(NSString*)device[@"IOClass"] compare:@"Xbox360Peripheral"] != NSOrderedSame) continue; fprintf(stdout, "%s,%i,%i\n", [key UTF8String], - [[device objectForKey:@"idVendor"] intValue], - [[device objectForKey:@"idProduct"] intValue]); + [device[@"idVendor"] intValue], + [device[@"idProduct"] intValue]); } - } - else if ((argc > 1) && (strcmp(argv[1], "edit") == 0) && (((argc - 2) % 3) == 0)) - { + } else if ((argc > 1) && (strcmp(argv[1], "edit") == 0) && (((argc - 2) % 3) == 0)) { NSMutableDictionary *saving; NSMutableDictionary *devices; saving = MakeMutableCopy(config); - devices = [saving objectForKey:@"IOKitPersonalities"]; + devices = saving[@"IOKitPersonalities"]; ScrubDevices(devices); AddDevices(devices, argc, argv); WriteDriverConfig(DRIVER_NAME, saving); @@ -189,6 +157,6 @@ int main (int argc, const char * argv[]) { else NSLog(@"Invalid number of parameters (%i)", argc); - [pool drain]; return 0; } +} diff --git a/DriverTool/DriverTool.xcodeproj/project.pbxproj b/DriverTool/DriverTool.xcodeproj/project.pbxproj deleted file mode 100644 index c5c59f0..0000000 --- a/DriverTool/DriverTool.xcodeproj/project.pbxproj +++ /dev/null @@ -1,235 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 45; - objects = { - -/* Begin PBXBuildFile section */ - 8DD76F9A0486AA7600D96B5E /* DriverTool.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* DriverTool.m */; settings = {ATTRIBUTES = (); }; }; - 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; }; - 8DD76F9F0486AA7600D96B5E /* DriverTool.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = C6859EA3029092ED04C91782 /* DriverTool.1 */; }; -/* End PBXBuildFile section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 8; - dstPath = /usr/share/man/man1/; - dstSubfolderSpec = 0; - files = ( - 8DD76F9F0486AA7600D96B5E /* DriverTool.1 in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 1; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 08FB7796FE84155DC02AAC07 /* DriverTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DriverTool.m; sourceTree = ""; }; - 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 32A70AAB03705E1F00C91783 /* DriverTool_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DriverTool_Prefix.pch; sourceTree = ""; }; - 8DD76FA10486AA7600D96B5E /* DriverTool */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DriverTool; sourceTree = BUILT_PRODUCTS_DIR; }; - C6859EA3029092ED04C91782 /* DriverTool.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = DriverTool.1; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8DD76F9B0486AA7600D96B5E /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 08FB7794FE84155DC02AAC07 /* DriverTool */ = { - isa = PBXGroup; - children = ( - 08FB7795FE84155DC02AAC07 /* Source */, - C6859EA2029092E104C91782 /* Documentation */, - 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */, - 1AB674ADFE9D54B511CA2CBB /* Products */, - ); - name = DriverTool; - sourceTree = ""; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 32A70AAB03705E1F00C91783 /* DriverTool_Prefix.pch */, - 08FB7796FE84155DC02AAC07 /* DriverTool.m */, - ); - name = Source; - sourceTree = ""; - }; - 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 08FB779EFE84155DC02AAC07 /* Foundation.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8DD76FA10486AA7600D96B5E /* DriverTool */, - ); - name = Products; - sourceTree = ""; - }; - C6859EA2029092E104C91782 /* Documentation */ = { - isa = PBXGroup; - children = ( - C6859EA3029092ED04C91782 /* DriverTool.1 */, - ); - name = Documentation; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8DD76F960486AA7600D96B5E /* DriverTool */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "DriverTool" */; - buildPhases = ( - 8DD76F990486AA7600D96B5E /* Sources */, - 8DD76F9B0486AA7600D96B5E /* Frameworks */, - 8DD76F9E0486AA7600D96B5E /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = DriverTool; - productInstallPath = "$(HOME)/bin"; - productName = DriverTool; - productReference = 8DD76FA10486AA7600D96B5E /* DriverTool */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "DriverTool" */; - compatibilityVersion = "Xcode 3.1"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* DriverTool */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DD76F960486AA7600D96B5E /* DriverTool */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 8DD76F990486AA7600D96B5E /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DD76F9A0486AA7600D96B5E /* DriverTool.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1DEB927508733DD40010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = DriverTool_Prefix.pch; - INSTALL_PATH = /usr/local/bin; - PRODUCT_NAME = DriverTool; - }; - name = Debug; - }; - 1DEB927608733DD40010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = DriverTool_Prefix.pch; - INSTALL_PATH = /usr/local/bin; - PRODUCT_NAME = DriverTool; - SDKROOT = ""; - }; - name = Release; - }; - 1DEB927908733DD40010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Debug; - }; - 1DEB927A08733DD40010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "DriverTool" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB927508733DD40010E9CD /* Debug */, - 1DEB927608733DD40010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "DriverTool" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB927908733DD40010E9CD /* Debug */, - 1DEB927A08733DD40010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/DriverTool/Info.plist b/DriverTool/Info.plist new file mode 100644 index 0000000..d092a1b --- /dev/null +++ b/DriverTool/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleName + ${PRODUCT_NAME} + CFBundleVersion + ${CURRENT_PROJECT_VERSION} + CFBundleIdentifier + com.mice.${PRODUCT_NAME:rfc1034identifier} + CFBundleShortVersionString + ${CURRENT_PROJECT_VERSION} + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + CFBundleInfoDictionaryVersion + 6.0 + + diff --git a/Feedback360/English.lproj/InfoPlist.strings b/Feedback360/English.lproj/InfoPlist.strings index aa95ec3..0d04b22 100644 --- a/Feedback360/English.lproj/InfoPlist.strings +++ b/Feedback360/English.lproj/InfoPlist.strings @@ -1,4 +1,4 @@ /* Localized versions of Info.plist keys */ CFBundleName = "Feedback360"; -NSHumanReadableCopyright = "© Colin Munro, 2005-2011"; \ No newline at end of file +NSHumanReadableCopyright = "© Colin Munro, 2005-2011"; diff --git a/Feedback360/Feedback360.cpp b/Feedback360/Feedback360.cpp new file mode 100644 index 0000000..7c2f306 --- /dev/null +++ b/Feedback360/Feedback360.cpp @@ -0,0 +1,755 @@ +/* + MICE Xbox 360 Controller driver for Mac OS X + Force Feedback module + Copyright (C) 2013 David Ryskalczyk + based on xi, Copyright (C) 2011 Masahiko Morii + + Feedback360.cpp - Main code for the FF plugin + + This file is part of Xbox360Controller. + + Xbox360Controller is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Xbox360Controller is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Xbox360Controller; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "Feedback360.h" +#include +#include +using std::max; +using std::min; + +#define LoopGranularity 10000 // Microseconds + +double CurrentTimeUsingMach() +{ + mach_timebase_info_data_t info = {0}; + if (mach_timebase_info(&info) != KERN_SUCCESS) { + //FIXME: why would this fail/set to fail more gracefully. + return -1.0; + } + + uint64_t start = mach_absolute_time(); + + uint64_t nanos = start * info.numer / info.denom; + return (double)nanos / NSEC_PER_SEC; +} + +static IOCFPlugInInterface functionMap360_IOCFPlugInInterface = { + // Padding required for COM + NULL, + // IUnknown + &Feedback360::sQueryInterface, + &Feedback360::sAddRef, + &Feedback360::sRelease, + // IOCFPlugInInterface + 1,0, // Version + &Feedback360::sProbe, + &Feedback360::sStart, + &Feedback360::sStop +}; + +static IOForceFeedbackDeviceInterface functionMap360_IOForceFeedbackDeviceInterface = { + // Padding required for COM + NULL, + // IUnknown + &Feedback360::sQueryInterface, + &Feedback360::sAddRef, + &Feedback360::sRelease, + // IOForceFeedbackDevice + &Feedback360::sGetVersion, + &Feedback360::sInitializeTerminate, + &Feedback360::sDestroyEffect, + &Feedback360::sDownloadEffect, + &Feedback360::sEscape, + &Feedback360::sGetEffectStatus, + &Feedback360::sGetForceFeedbackCapabilities, + &Feedback360::sGetForceFeedbackState, + &Feedback360::sSendForceFeedbackCommand, + &Feedback360::sSetProperty, + &Feedback360::sStartEffect, + &Feedback360::sStopEffect +}; + +Feedback360::Feedback360() : fRefCount(1), EffectIndex(1), Stopped(true), +Paused(false), PausedTime(0), LastTime(0), Gain(10000), PrvLeftLevel(0), +PrvRightLevel(0), Actuator(true), Manual(false) +{ + EffectList = Feedback360EffectVector(); + + iIOCFPlugInInterface.pseudoVTable = (IUnknownVTbl *) &functionMap360_IOCFPlugInInterface; + iIOCFPlugInInterface.obj = this; + + iIOForceFeedbackDeviceInterface.pseudoVTable = (IUnknownVTbl *) &functionMap360_IOForceFeedbackDeviceInterface; + iIOForceFeedbackDeviceInterface.obj = this; + + FactoryID = kFeedback360Uuid; + CFRetain(FactoryID); + CFPlugInAddInstanceForFactory(FactoryID); +} + +Feedback360::~Feedback360() +{ + CFPlugInRemoveInstanceForFactory(FactoryID); + CFRelease(FactoryID); +} + +HRESULT Feedback360::QueryInterface(REFIID iid, LPVOID *ppv) +{ + CFUUIDRef interface = CFUUIDCreateFromUUIDBytes(kCFAllocatorDefault, iid); + + if(CFEqual(interface, kIOForceFeedbackDeviceInterfaceID)) + *ppv = &this->iIOForceFeedbackDeviceInterface; + // IUnknown || IOCFPlugInInterface + else if(CFEqual(interface, IUnknownUUID) || CFEqual(interface, kIOCFPlugInInterfaceID)) + *ppv = &this->iIOCFPlugInInterface; + else + *ppv = NULL; + + // Done + CFRelease(interface); + if ((*ppv) == NULL) return E_NOINTERFACE; + else { + this->iIOCFPlugInInterface.pseudoVTable->AddRef(*ppv); + } + return FF_OK; +} + +ULONG Feedback360::AddRef() +{ + return ++fRefCount; +} + +ULONG Feedback360::Release() +{ + ULONG returnValue = fRefCount - 1; + if(returnValue > 0) { + fRefCount = returnValue; + } else if(returnValue == 0) { + fRefCount = returnValue; + delete this; + } else { + returnValue = 0; + } + return returnValue; +} + +IOCFPlugInInterface** Feedback360::Alloc(void) +{ + Feedback360 *me = new Feedback360(); + if (!me) { + return NULL; + } + return (IOCFPlugInInterface **)(&me->iIOCFPlugInInterface.pseudoVTable); +} + +IOReturn Feedback360::Probe(CFDictionaryRef propertyTable, io_service_t service, SInt32 *order) +{ + if ((service==0) + || ((!IOObjectConformsTo(service,"Xbox360ControllerClass")) + && (!IOObjectConformsTo(service,"Wireless360Controller")))) return kIOReturnBadArgument; + return FF_OK; +} + +IOReturn Feedback360::Start(CFDictionaryRef propertyTable,io_service_t service) +{ + return FF_OK; +} + +IOReturn Feedback360::Stop(void) +{ + return FF_OK; +} + +HRESULT Feedback360::SetProperty(FFProperty property, void *value) +{ + if(property != FFPROP_FFGAIN) { + return FFERR_UNSUPPORTED; + } + + UInt32 NewGain = *((UInt32*)value); + __block HRESULT Result = FF_OK; + + dispatch_sync(Queue, ^{ + if (1 <= NewGain && NewGain <= 10000) + { + Gain = NewGain; + } else { + Gain = max((UInt32)1, min(NewGain, (UInt32)10000)); + Result = FF_TRUNCATED; + } + }); + + return Result; +} + +HRESULT Feedback360::StartEffect(FFEffectDownloadID EffectHandle, FFEffectStartFlag Mode, UInt32 Count) +{ + dispatch_sync(Queue, ^{ + for (Feedback360EffectIterator effectIterator = EffectList.begin() ; effectIterator != EffectList.end(); ++effectIterator) + { + if (effectIterator->Handle == EffectHandle) + { + effectIterator->Status = FFEGES_PLAYING; + effectIterator->PlayCount = Count; + effectIterator->StartTime = CurrentTimeUsingMach(); + Stopped = false; + } else { + if (Mode & FFES_SOLO) { + effectIterator->Status = NULL; + } + } + } + }); + return FF_OK; +} + +HRESULT Feedback360::StopEffect(UInt32 EffectHandle) +{ + dispatch_sync(Queue, ^{ + for (Feedback360EffectIterator effectIterator = EffectList.begin() ; effectIterator != EffectList.end(); ++effectIterator) + { + if (effectIterator->Handle == EffectHandle) + { + effectIterator->Status = NULL; + break; + } + } + }); + return FF_OK; +} + +HRESULT Feedback360::DownloadEffect(CFUUIDRef EffectType, FFEffectDownloadID *EffectHandle, FFEFFECT *DiEffect, FFEffectParameterFlag Flags) +{ + __block HRESULT Result = FF_OK; + + if (Flags & FFEP_NODOWNLOAD) + { + return FF_OK; + } + + dispatch_sync(Queue, ^{ + Feedback360Effect *Effect = NULL; + if (*EffectHandle == 0) { + EffectList.push_back(Feedback360Effect(EffectIndex++)); + Effect = &(EffectList.back()); + *EffectHandle = Effect->Handle; + } else { + for (LONG Index = 0; Index < EffectList.size(); Index++) { + if (EffectList[Index].Handle == *EffectHandle) { + Effect = &(EffectList[Index]); + break; + } + } + } + + if (Effect == NULL || Result == -1) { + Result = FFERR_INTERNAL; + } + else { + Effect->Type = EffectType; + Effect->DiEffect.dwFlags = DiEffect->dwFlags; + + if( Flags & FFEP_DURATION ) + { + Effect->DiEffect.dwDuration = DiEffect->dwDuration; + } + + if( Flags & FFEP_SAMPLEPERIOD ) + { + Effect->DiEffect.dwSamplePeriod = DiEffect->dwSamplePeriod; + } + + if( Flags & FFEP_GAIN ) + { + Effect->DiEffect.dwGain = DiEffect->dwGain; + } + + if( Flags & FFEP_TRIGGERBUTTON ) + { + Effect->DiEffect.dwTriggerButton = DiEffect->dwTriggerButton; + } + + if( Flags & FFEP_TRIGGERREPEATINTERVAL ) + { + Effect->DiEffect.dwTriggerRepeatInterval = DiEffect->dwTriggerRepeatInterval; + } + + if( Flags & FFEP_AXES ) + { + Effect->DiEffect.cAxes = DiEffect->cAxes; + Effect->DiEffect.rgdwAxes = NULL; + } + + if( Flags & FFEP_DIRECTION ) + { + Effect->DiEffect.cAxes = DiEffect->cAxes; + Effect->DiEffect.rglDirection = NULL; + } + + if( ( Flags & FFEP_ENVELOPE ) && DiEffect->lpEnvelope != NULL ) + { + memcpy( &Effect->DiEnvelope, DiEffect->lpEnvelope, sizeof( FFENVELOPE ) ); + if( Effect->DiEffect.dwDuration - Effect->DiEnvelope.dwFadeTime + < Effect->DiEnvelope.dwAttackTime ) + { + Effect->DiEnvelope.dwFadeTime = Effect->DiEnvelope.dwAttackTime; + } + Effect->DiEffect.lpEnvelope = &Effect->DiEnvelope; + } + + Effect->DiEffect.cbTypeSpecificParams = DiEffect->cbTypeSpecificParams; + + if( Flags & FFEP_TYPESPECIFICPARAMS ) + { + if(CFEqual(EffectType, kFFEffectType_CustomForce_ID)) { + memcpy( + &Effect->DiCustomForce + ,DiEffect->lpvTypeSpecificParams + ,DiEffect->cbTypeSpecificParams ); + Effect->DiEffect.lpvTypeSpecificParams = &Effect->DiCustomForce; + } + + else if(CFEqual(EffectType, kFFEffectType_ConstantForce_ID)) { + memcpy( + &Effect->DiConstantForce + ,DiEffect->lpvTypeSpecificParams + ,DiEffect->cbTypeSpecificParams ); + Effect->DiEffect.lpvTypeSpecificParams = &Effect->DiConstantForce; + } + else if(CFEqual(EffectType, kFFEffectType_Square_ID) || CFEqual(EffectType, kFFEffectType_Sine_ID) || CFEqual(EffectType, kFFEffectType_Triangle_ID) || CFEqual(EffectType, kFFEffectType_SawtoothUp_ID) || CFEqual(EffectType, kFFEffectType_SawtoothDown_ID) ) { + memcpy( + &Effect->DiPeriodic + ,DiEffect->lpvTypeSpecificParams + ,DiEffect->cbTypeSpecificParams ); + Effect->DiEffect.lpvTypeSpecificParams = &Effect->DiPeriodic; + } + else if(CFEqual(EffectType, kFFEffectType_RampForce_ID)) { + memcpy( + &Effect->DiRampforce + ,DiEffect->lpvTypeSpecificParams + ,DiEffect->cbTypeSpecificParams ); + Effect->DiEffect.lpvTypeSpecificParams = &Effect->DiRampforce; + } + } + + if( Flags & FFEP_STARTDELAY ) + { + Effect->DiEffect.dwStartDelay = DiEffect->dwStartDelay; + } + + if( Flags & FFEP_START ) + { + Effect->Status = FFEGES_PLAYING; + Effect->PlayCount = 1; + Effect->StartTime = CurrentTimeUsingMach(); + } + + if( Flags & FFEP_NORESTART ) + { + ; + } + Result = FF_OK; + } + }); + return Result; +} + +HRESULT Feedback360::GetForceFeedbackState(ForceFeedbackDeviceState *DeviceState) +{ + if (DeviceState->dwSize != sizeof(FFDEVICESTATE)) + { + return FFERR_INVALIDPARAM; + } + + dispatch_sync(Queue, ^{ + DeviceState->dwState = NULL; + if( EffectList.size() == 0 ) + { + DeviceState->dwState |= FFGFFS_EMPTY; + } + if( Stopped == true ) + { + DeviceState->dwState |= FFGFFS_STOPPED; + } + if( Paused == true ) + { + DeviceState->dwState |= FFGFFS_PAUSED; + } + if (Actuator == true) + { + DeviceState->dwState |= FFGFFS_ACTUATORSON; + } else { + DeviceState->dwState |= FFGFFS_ACTUATORSOFF; + } + DeviceState->dwState |= FFGFFS_POWERON; + DeviceState->dwState |= FFGFFS_SAFETYSWITCHOFF; + DeviceState->dwState |= FFGFFS_USERFFSWITCHON; + + DeviceState->dwLoad = 0; + }); + + return FF_OK; +} + +HRESULT Feedback360::GetForceFeedbackCapabilities(FFCAPABILITIES *capabilities) +{ + capabilities->ffSpecVer.majorRev=kFFPlugInAPIMajorRev; + capabilities->ffSpecVer.minorAndBugRev=kFFPlugInAPIMinorAndBugRev; + capabilities->ffSpecVer.stage=kFFPlugInAPIStage; + capabilities->ffSpecVer.nonRelRev=kFFPlugInAPINonRelRev; + capabilities->supportedEffects=FFCAP_ET_CUSTOMFORCE|FFCAP_ET_CONSTANTFORCE|FFCAP_ET_RAMPFORCE|FFCAP_ET_SQUARE|FFCAP_ET_SINE|FFCAP_ET_TRIANGLE|FFCAP_ET_SAWTOOTHUP|FFCAP_ET_SAWTOOTHDOWN; + capabilities->emulatedEffects=0; + capabilities->subType=FFCAP_ST_VIBRATION; + capabilities->numFfAxes=2; + capabilities->ffAxes[0]=FFJOFS_X; + capabilities->ffAxes[1]=FFJOFS_Y; + capabilities->storageCapacity=256; + capabilities->playbackCapacity=1; + capabilities->driverVer.majorRev=FeedbackDriverVersionMajor; + capabilities->driverVer.minorAndBugRev=FeedbackDriverVersionMinor; + capabilities->driverVer.stage=FeedbackDriverVersionStage; + capabilities->driverVer.nonRelRev=FeedbackDriverVersionNonRelRev; + capabilities->firmwareVer.majorRev=1; + capabilities->firmwareVer.minorAndBugRev=0; + capabilities->firmwareVer.stage=developStage; + capabilities->firmwareVer.nonRelRev=0; + capabilities->hardwareVer.majorRev=1; + capabilities->hardwareVer.minorAndBugRev=0; + capabilities->hardwareVer.stage=developStage; + capabilities->hardwareVer.nonRelRev=0; + return FF_OK; +} + +HRESULT Feedback360::SendForceFeedbackCommand(FFCommandFlag state) +{ + __block HRESULT Result = FF_OK; + + dispatch_sync(Queue, ^{ + switch (state) { + case FFSFFC_RESET: + EffectList.clear(); + Stopped = true; + Paused = false; + break; + + case FFSFFC_STOPALL: + for (Feedback360EffectIterator effectIterator = EffectList.begin() ; effectIterator != EffectList.end(); ++effectIterator) + { + effectIterator->Status = NULL; + } + Stopped = true; + Paused = false; + break; + + case FFSFFC_PAUSE: + Paused = true; + PausedTime = CurrentTimeUsingMach(); + break; + + case FFSFFC_CONTINUE: + for (Feedback360EffectIterator effectIterator = EffectList.begin() ; effectIterator != EffectList.end(); ++effectIterator) + { + effectIterator->StartTime += ( CurrentTimeUsingMach() - PausedTime ); + } + Paused = false; + break; + + case FFSFFC_SETACTUATORSON: + Actuator = true; + break; + + case FFSFFC_SETACTUATORSOFF: + Actuator = false; + break; + + default: + Result = FFERR_INVALIDPARAM; + break; + } + }); + //return Result; + return FF_OK; +} + +HRESULT Feedback360::InitializeTerminate(NumVersion APIversion, io_object_t hidDevice, boolean_t begin) +{ + if(begin) { + if (APIversion.majorRev != kFFPlugInAPIMajorRev) + { + // fprintf(stderr,"Feedback: Invalid version\n"); + return FFERR_INVALIDPARAM; + } + // From probe + if( (hidDevice==0) + || ((!IOObjectConformsTo(hidDevice,"Xbox360ControllerClass")) + && (!IOObjectConformsTo(hidDevice,"Wireless360Controller"))) ) + { + // fprintf(stderr,"Feedback: Invalid device\n"); + return FFERR_INVALIDPARAM; + } + if(!Device_Initialise(&this->device, hidDevice)) { + // fprintf(stderr,"Feedback: Failed to initialise\n"); + return FFERR_NOINTERFACE; + } + Queue = dispatch_queue_create("com.mice.driver.Feedback360", NULL); + Timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, Queue); + dispatch_source_set_timer(Timer, dispatch_walltime(NULL, 0), LoopGranularity*1000, 10); + dispatch_set_context(Timer, this); + dispatch_source_set_event_handler_f(Timer, EffectProc); + dispatch_resume(Timer); + } + else { + dispatch_sync(Queue, ^{ + dispatch_source_cancel(Timer); + SetForce(0, 0); + Device_Finalise(&this->device); + }); + + } + return FF_OK; +} + +HRESULT Feedback360::DestroyEffect(FFEffectDownloadID EffectHandle) +{ + __block HRESULT Result = FF_OK; + dispatch_sync(Queue, ^{ + for (Feedback360EffectIterator effectIterator = EffectList.begin() ; effectIterator != EffectList.end(); ++effectIterator) + { + if (effectIterator->Handle == EffectHandle) + { + EffectList.erase(effectIterator); + break; + } + } + }); + return Result; +} + +HRESULT Feedback360::Escape(FFEffectDownloadID downloadID, FFEFFESCAPE *escape) +{ + if (downloadID!=0) return FFERR_UNSUPPORTED; + if (escape->dwSize < sizeof(FFEFFESCAPE)) return FFERR_INVALIDPARAM; + escape->cbOutBuffer=0; + switch (escape->dwCommand) { + case 0x00: // Control motors + if(escape->cbInBuffer!=1) return FFERR_INVALIDPARAM; + dispatch_sync(Queue, ^{ + Manual=((unsigned char*)escape->lpvInBuffer)[0]!=0x00; + }); + break; + + case 0x01: // Set motors + if (escape->cbInBuffer!=2) return FFERR_INVALIDPARAM; + dispatch_sync(Queue, ^{ + if(Manual) { + unsigned char *data=(unsigned char *)escape->lpvInBuffer; + unsigned char buf[]={0x00,0x04,data[0],data[1]}; + Device_Send(&this->device,buf,sizeof(buf)); + } + }); + break; + + case 0x02: // Set LED + if (escape->cbInBuffer!=1) return FFERR_INVALIDPARAM; + { + dispatch_sync(Queue, ^{ + unsigned char *data=(unsigned char *)escape->lpvInBuffer; + unsigned char buf[]={0x01,0x03,data[0]}; + Device_Send(&this->device,buf,sizeof(buf)); + }); + } + break; + + case 0x03: // Power off + { + dispatch_sync(Queue, ^{ + unsigned char buf[] = {0x02, 0x02}; + Device_Send(&this->device, buf, sizeof(buf)); + }); + } + break; + + default: + fprintf(stderr, "Xbox360Controller FF plugin: Unknown escape (%i)\n", (int)escape->dwCommand); + return FFERR_UNSUPPORTED; + } + return FF_OK; +} + +void Feedback360::SetForce(LONG LeftLevel, LONG RightLevel) +{ + //fprintf(stderr, "LS: %d; RS: %d\n", (unsigned char)MIN( 255, LeftLevel * Gain / 10000 ), (unsigned char)MIN( 255, RightLevel * Gain / 10000 )); + unsigned char buf[] = {0x00, 0x04, (unsigned char)min(SCALE_MAX, LeftLevel * (LONG)Gain / 10000 ), (unsigned char)min(SCALE_MAX, RightLevel * (LONG)Gain / 10000 )}; + if (!Manual) Device_Send(&device, buf, sizeof(buf)); +} + +void Feedback360::EffectProc( void *params ) +{ + Feedback360 *cThis = (Feedback360 *)params; + + LONG LeftLevel = 0; + LONG RightLevel = 0; + LONG Gain = cThis->Gain; + LONG CalcResult = 0; + + if (cThis->Actuator == true) + { + for (Feedback360EffectIterator effectIterator = cThis->EffectList.begin(); effectIterator != cThis->EffectList.end(); ++effectIterator) + { + if((CurrentTimeUsingMach() - cThis->LastTime*1000*1000) >= effectIterator->DiEffect.dwSamplePeriod) { + CalcResult = effectIterator->Calc(&LeftLevel, &RightLevel); + } + } + } + + if ((cThis->PrvLeftLevel != LeftLevel || cThis->PrvRightLevel != RightLevel) && (CalcResult != -1)) + { + //fprintf(stderr, "PL: %d, PR: %d; L: %d, R: %d; \n", cThis->PrvLeftLevel, cThis->PrvRightLevel, LeftLevel, RightLevel); + cThis->SetForce((unsigned char)min(SCALE_MAX, LeftLevel * Gain / 10000),(unsigned char)min(SCALE_MAX, RightLevel * Gain / 10000 )); + + cThis->PrvLeftLevel = LeftLevel; + cThis->PrvRightLevel = RightLevel; + } +} + +HRESULT Feedback360::GetEffectStatus(FFEffectDownloadID EffectHandle, FFEffectStatusFlag *Status) +{ + dispatch_sync(Queue, ^{ + for (Feedback360EffectIterator effectIterator = EffectList.begin() ; effectIterator != EffectList.end(); ++effectIterator) + { + if (effectIterator->Handle == EffectHandle) + { + *Status = effectIterator->Status; + break; + } + } + }); + return FF_OK; +} + +HRESULT Feedback360::GetVersion(ForceFeedbackVersion *version) +{ + version->apiVersion.majorRev = kFFPlugInAPIMajorRev; + version->apiVersion.minorAndBugRev = kFFPlugInAPIMinorAndBugRev; + version->apiVersion.stage = kFFPlugInAPIStage; + version->apiVersion.nonRelRev = kFFPlugInAPINonRelRev; + version->plugInVersion.majorRev = FeedbackDriverVersionMajor; + version->plugInVersion.minorAndBugRev = FeedbackDriverVersionMinor; + version->plugInVersion.stage = FeedbackDriverVersionStage; + version->plugInVersion.nonRelRev = FeedbackDriverVersionNonRelRev; + return FF_OK; +} + +// static c->c++ glue functions +HRESULT Feedback360::sQueryInterface(void *self, REFIID iid, LPVOID *ppv) +{ + Feedback360 *obj = ((Xbox360InterfaceMap *)self)->obj; + return obj->QueryInterface(iid, ppv); +} + +ULONG Feedback360::sAddRef(void *self) +{ + Feedback360 *obj = ( (Xbox360InterfaceMap *) self)->obj; + return obj->AddRef(); +} + +ULONG Feedback360::sRelease(void *self) +{ + Feedback360 *obj = ( (Xbox360InterfaceMap *) self)->obj; + return obj->Release(); +} + +IOReturn Feedback360::sProbe(void *self, CFDictionaryRef propertyTable, io_service_t service, SInt32 *order) +{ + return getThis(self)->Probe(propertyTable, service, order); +} + +IOReturn Feedback360::sStart(void *self, CFDictionaryRef propertyTable, io_service_t service) +{ + return getThis(self)->Start(propertyTable, service); +} + +IOReturn Feedback360::sStop(void *self) +{ + return getThis(self)->Stop(); +} + +HRESULT Feedback360::sGetVersion(void * self, ForceFeedbackVersion * version) +{ + return Feedback360::getThis(self)->GetVersion(version); +} + +HRESULT Feedback360::sInitializeTerminate(void * self, NumVersion forceFeedbackAPIVersion, io_object_t hidDevice, boolean_t begin) +{ + return Feedback360::getThis(self)->InitializeTerminate(forceFeedbackAPIVersion, hidDevice, begin); +} + +HRESULT Feedback360::sDestroyEffect(void * self, FFEffectDownloadID downloadID) +{ + return Feedback360::getThis(self)->DestroyEffect(downloadID); +} + +HRESULT Feedback360::sDownloadEffect(void * self, CFUUIDRef effectType, FFEffectDownloadID *pDownloadID, FFEFFECT * pEffect, FFEffectParameterFlag flags) +{ + return Feedback360::getThis(self)->DownloadEffect(effectType, pDownloadID, pEffect, flags); +} + +HRESULT Feedback360::sEscape(void * self, FFEffectDownloadID downloadID, FFEFFESCAPE * pEscape) +{ + return Feedback360::getThis(self)->Escape(downloadID, pEscape); +} + +HRESULT Feedback360::sGetEffectStatus(void * self, FFEffectDownloadID downloadID, FFEffectStatusFlag * pStatusCode) +{ + return Feedback360::getThis(self)->GetEffectStatus(downloadID, pStatusCode); +} + +HRESULT Feedback360::sGetForceFeedbackState(void * self, ForceFeedbackDeviceState * pDeviceState) +{ + return Feedback360::getThis(self)->GetForceFeedbackState(pDeviceState); +} + +HRESULT Feedback360::sGetForceFeedbackCapabilities(void * self, FFCAPABILITIES * capabilities) +{ + return Feedback360::getThis(self)->GetForceFeedbackCapabilities(capabilities); +} + +HRESULT Feedback360::sSendForceFeedbackCommand(void * self, FFCommandFlag state) +{ + return Feedback360::getThis(self)->SendForceFeedbackCommand(state); +} + +HRESULT Feedback360::sSetProperty(void * self, FFProperty property, void * pValue) +{ + return Feedback360::getThis(self)->SetProperty(property, pValue); +} + +HRESULT Feedback360::sStartEffect(void * self, FFEffectDownloadID downloadID, FFEffectStartFlag mode, UInt32 iterations) +{ + return Feedback360::getThis(self)->StartEffect(downloadID, mode, iterations); +} + +HRESULT Feedback360::sStopEffect(void * self, UInt32 downloadID) +{ + return Feedback360::getThis(self)->StopEffect(downloadID); +} + +// External factory function +void* Control360Factory(CFAllocatorRef allocator, CFUUIDRef typeID) +{ + void* result = NULL; + if (CFEqual(typeID, kIOForceFeedbackLibTypeID)) + result = (void*)Feedback360::Alloc(); + return result; +} diff --git a/Feedback360/Feedback360.exp b/Feedback360/Feedback360.exp new file mode 100644 index 0000000..7684653 --- /dev/null +++ b/Feedback360/Feedback360.exp @@ -0,0 +1,7 @@ +# Feedback360.exp +# 360 Driver +# +# Created by C.W. Betts on 3/3/14. +# Copyright (c) 2014 GitHub. All rights reserved. + +_Control360Factory diff --git a/Feedback360/Feedback360.h b/Feedback360/Feedback360.h new file mode 100644 index 0000000..cea2dcb --- /dev/null +++ b/Feedback360/Feedback360.h @@ -0,0 +1,155 @@ +/* + MICE Xbox 360 Controller driver for Mac OS X + Force Feedback module + Copyright (C) 2013 David Ryskalczyk + based on xi, Copyright (C) 2011 Masahiko Morii + + Feedback360.h - defines the structure used for the driver (COM object and emulator) + + This file is part of Xbox360Controller. + + Xbox360Controller is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Xbox360Controller is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Xbox360Controller; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef Feedback360_Feedback360_h +#define Feedback360_Feedback360_h + +#include +#include +#include + +#include "devlink.h" +#include "Feedback360Effect.h" + +#define FeedbackDriverVersionMajor 1 +#define FeedbackDriverVersionMinor 0 +#define FeedbackDriverVersionStage developStage +#define FeedbackDriverVersionNonRelRev 0 + +class Feedback360 : IUnknown +{ +public: + // constructor/destructor + Feedback360(void); + virtual ~Feedback360(void); + +private: + //disable copy constructor + Feedback360(Feedback360 &src); + void operator = (Feedback360 &src); + + UInt32 fRefCount; + + typedef struct _Xbox360InterfaceMap + { + IUnknownVTbl *pseudoVTable; + Feedback360 *obj; + } Xbox360InterfaceMap; + + // IOCFPlugin interfacing variables and functions +public: + static IOCFPlugInInterface** Alloc(void); + + // static functions called by the ForceFeedback API + static HRESULT sQueryInterface(void *self, REFIID iid, LPVOID *ppv); + static ULONG sAddRef(void *self); + static ULONG sRelease(void *self); + + static IOReturn sProbe ( void * self, CFDictionaryRef propertyTable, io_service_t service, SInt32 * order ); + static IOReturn sStart ( void * self, CFDictionaryRef propertyTable, io_service_t service ); + static IOReturn sStop ( void * self ); + + static HRESULT sGetVersion(void * interface, ForceFeedbackVersion * version); + static HRESULT sInitializeTerminate(void * interface, NumVersion forceFeedbackAPIVersion, io_object_t hidDevice, boolean_t begin ); + static HRESULT sDestroyEffect(void * interface, FFEffectDownloadID downloadID ); + static HRESULT sDownloadEffect( void * interface, CFUUIDRef effectType, FFEffectDownloadID *pDownloadID, FFEFFECT * pEffect, FFEffectParameterFlag flags ); + static HRESULT sEscape( void * interface, FFEffectDownloadID downloadID, FFEFFESCAPE * pEscape ); + static HRESULT sGetEffectStatus( void * interface, FFEffectDownloadID downloadID, FFEffectStatusFlag * pStatusCode ); + static HRESULT sGetForceFeedbackState( void * interface, ForceFeedbackDeviceState * pDeviceState ); + static HRESULT sGetForceFeedbackCapabilities( void * interface, FFCAPABILITIES *capabilities ); + static HRESULT sSendForceFeedbackCommand( void * interface, FFCommandFlag state ); + static HRESULT sSetProperty( void * interface, FFProperty property, void * pValue ); + static HRESULT sStartEffect( void * interface, FFEffectDownloadID downloadID, FFEffectStartFlag mode, UInt32 iterations ); + static HRESULT sStopEffect( void * interface, UInt32 downloadID ); + + virtual HRESULT QueryInterface(REFIID iid, LPVOID* ppv); + virtual ULONG AddRef(void); + virtual ULONG Release(void); + +private: + typedef std::vector Feedback360EffectVector; + typedef Feedback360EffectVector::iterator Feedback360EffectIterator; + // helper function + static inline Feedback360 *getThis (void *self) { return (Feedback360 *) ((Xbox360InterfaceMap *) self)->obj; } + + // interfacing + Xbox360InterfaceMap iIOCFPlugInInterface; + Xbox360InterfaceMap iIOForceFeedbackDeviceInterface; + DeviceLink device; + + // GCD queue and timer + dispatch_queue_t Queue; + dispatch_source_t Timer; + + // effects handling + Feedback360EffectVector EffectList; + UInt32 EffectIndex; + + DWORD Gain; + bool Actuator; + + LONG PrvLeftLevel, PrvRightLevel; + bool Stopped; + bool Paused; + bool Manual; + double LastTime; + double PausedTime; + CFUUIDRef FactoryID; + + void SetForce(LONG LeftLevel, LONG RightLevel); + + // event loop func + static void EffectProc( void *params ); + + // actual member functions ultimately called by the FF API (through the static functions) + virtual IOReturn Probe ( CFDictionaryRef propertyTable, io_service_t service, SInt32 * order ); + virtual IOReturn Start ( CFDictionaryRef propertyTable, io_service_t service ); + virtual IOReturn Stop ( void ); + + virtual HRESULT GetVersion(ForceFeedbackVersion * version); + virtual HRESULT InitializeTerminate(NumVersion forceFeedbackAPIVersion, io_object_t hidDevice, boolean_t begin); + virtual HRESULT DestroyEffect(FFEffectDownloadID downloadID); + virtual HRESULT DownloadEffect(CFUUIDRef effectType, FFEffectDownloadID *pDownloadID, FFEFFECT * pEffect, FFEffectParameterFlag flags); + virtual HRESULT Escape(FFEffectDownloadID downloadID, FFEFFESCAPE * pEscape); + virtual HRESULT GetEffectStatus(FFEffectDownloadID downloadID, FFEffectStatusFlag * pStatusCode); + virtual HRESULT GetForceFeedbackState(ForceFeedbackDeviceState * pDeviceState); + virtual HRESULT GetForceFeedbackCapabilities(FFCAPABILITIES *capabilities); + virtual HRESULT SendForceFeedbackCommand(FFCommandFlag state); + virtual HRESULT SetProperty(FFProperty property, void * pValue); + virtual HRESULT StartEffect(FFEffectDownloadID downloadID, FFEffectStartFlag mode, UInt32 iterations); + virtual HRESULT StopEffect(UInt32 downloadID); +}; + +// B8ED278F-EC8A-4E8E-B4CF-13E2A9D68E83 +#define kFeedback360Uuid CFUUIDGetConstantUUIDWithBytes(kCFAllocatorSystemDefault, \ +0xB8, 0xED, 0x27, 0x8F, 0xEC, 0x8A, 0x4E, 0x8E, \ +0xB4, 0xCF, 0x13, 0xE2, 0xA9, 0xD6, 0x8E, 0x83) + +// Factory function +extern "C" { + void* Control360Factory(CFAllocatorRef allocator, CFUUIDRef uuid); +} + +#endif diff --git a/Feedback360/Feedback360.xcodeproj/colin.mode1 b/Feedback360/Feedback360.xcodeproj/colin.mode1 deleted file mode 100644 index 10ad1c5..0000000 --- a/Feedback360/Feedback360.xcodeproj/colin.mode1 +++ /dev/null @@ -1,1326 +0,0 @@ - - - - - ActivePerspectiveName - Project - AllowedModules - - - BundleLoadPath - - MaxInstances - n - Module - PBXSmartGroupTreeModule - Name - Groups and Files Outline View - - - BundleLoadPath - - MaxInstances - n - Module - PBXNavigatorGroup - Name - Editor - - - BundleLoadPath - - MaxInstances - n - Module - XCTaskListModule - Name - Task List - - - BundleLoadPath - - MaxInstances - n - Module - XCDetailModule - Name - File and Smart Group Detail Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXBuildResultsModule - Name - Detailed Build Results Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXProjectFindModule - Name - Project Batch Find Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXRunSessionModule - Name - Run Log - - - BundleLoadPath - - MaxInstances - n - Module - PBXBookmarksModule - Name - Bookmarks Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXClassBrowserModule - Name - Class Browser - - - BundleLoadPath - - MaxInstances - n - Module - PBXCVSModule - Name - Source Code Control Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXDebugBreakpointsModule - Name - Debug Breakpoints Tool - - - BundleLoadPath - - MaxInstances - n - Module - XCDockableInspector - Name - Inspector - - - BundleLoadPath - - MaxInstances - n - Module - PBXOpenQuicklyModule - Name - Open Quickly Tool - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugSessionModule - Name - Debugger - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugCLIModule - Name - Debug Console - - - Description - DefaultDescriptionKey - DockingSystemVisible - - Extension - mode1 - FavBarConfig - - PBXProjectModuleGUID - 3B2EF59109661AF5007BFB7B - XCBarModuleItemNames - - XCBarModuleItems - - - FirstTimeWindowDisplayed - - Identifier - com.apple.perspectives.project.mode1 - MajorVersion - 31 - MinorVersion - 1 - Name - Default - Notifications - - OpenEditors - - PerspectiveWidths - - -1 - -1 - - Perspectives - - - ChosenToolbarItems - - active-target-popup - active-buildstyle-popup - action - NSToolbarFlexibleSpaceItem - buildOrClean - build-and-runOrDebug - com.apple.ide.PBXToolbarStopButton - get-info - toggle-editor - NSToolbarFlexibleSpaceItem - com.apple.pbx.toolbar.searchfield - - ControllerClassBaseName - - IconName - WindowOfProjectWithEditor - Identifier - perspective.project - IsVertical - - Layout - - - BecomeActive - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 089C166AFE841209C02AAC07 - 08FB77AFFE84173DC02AAC07 - 089C167CFE841241C02AAC07 - 3B2EF5470965B8E3007BFB7B - 089C1671FE841209C02AAC07 - 3B2EF54B0965C358007BFB7B - 0AA1909FFE8422F4C02AAC07 - 19C28FB6FE9D52B211CA2CBB - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 338}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 356}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 308 400 690 397 0 0 1280 1002 - - Module - PBXSmartGroupTreeModule - Proportion - 203pt - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20306471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CE0B20406471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - - SplitCount - 1 - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {482, 0}} - RubberWindowFrame - 308 400 690 397 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20506471E060097A5F4 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{0, 5}, {482, 351}} - RubberWindowFrame - 308 400 690 397 0 0 1280 1002 - - Module - XCDetailModule - Proportion - 351pt - - - Proportion - 482pt - - - Name - Project - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - XCModuleDock - PBXNavigatorGroup - XCDetailModule - - TableOfContents - - 3BCC40840BDA915400B1619B - 1CE0B1FE06471DED0097A5F4 - 3BCC40850BDA915400B1619B - 1CE0B20306471E060097A5F4 - 1CE0B20506471E060097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default - - - ControllerClassBaseName - - IconName - WindowOfProject - Identifier - perspective.morph - IsVertical - 0 - Layout - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 11E0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 337}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 1 - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 355}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 373 269 690 397 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 100% - - - Name - Morph - PreferredWidth - 300 - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - - TableOfContents - - 11E0B1FE06471DED0097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default.short - - - PerspectivesBarVisible - - ShelfIsVisible - - SourceDescription - file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' - StatusbarIsVisible - - TimeStamp - 0.0 - ToolbarDisplayMode - 1 - ToolbarIsVisible - - ToolbarSizeMode - 1 - Type - Perspectives - UpdateMessage - The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? - WindowJustification - 5 - WindowOrderList - - 3B2EF5820965C4A5007BFB7B - /Users/colin/Projects2/OSX/360 Controller/Feedback360/Feedback360.xcodeproj - - WindowString - 308 400 690 397 0 0 1280 1002 - WindowTools - - - FirstTimeWindowDisplayed - - Identifier - windowTool.build - IsVertical - - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528F0623707200166675 - PBXProjectModuleLabel - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {500, 218}} - RubberWindowFrame - 691 470 500 500 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 218pt - - - ContentConfiguration - - PBXBuildLogShowsTranscriptDefaultKey - {{0, 5}, {500, 231}} - PBXProjectModuleGUID - XCMainBuildResultsModuleGUID - PBXProjectModuleLabel - Build - XCBuildResultsTrigger_Collapse - 1021 - XCBuildResultsTrigger_Open - 1011 - - GeometryConfiguration - - Frame - {{0, 223}, {500, 236}} - RubberWindowFrame - 691 470 500 500 0 0 1280 1002 - - Module - PBXBuildResultsModule - Proportion - 236pt - - - Proportion - 459pt - - - Name - Build Results - ServiceClasses - - PBXBuildResultsModule - - StatusbarIsVisible - - TableOfContents - - 3B2EF5820965C4A5007BFB7B - 3BCC40880BDA916800B1619B - 1CD0528F0623707200166675 - XCMainBuildResultsModuleGUID - - ToolbarConfiguration - xcode.toolbar.config.build - WindowString - 691 470 500 500 0 0 1280 1002 - WindowToolGUID - 3B2EF5820965C4A5007BFB7B - WindowToolIsVisible - - - - Identifier - windowTool.debugger - Layout - - - Dock - - - ContentConfiguration - - Debugger - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {317, 164}} - {{317, 0}, {377, 164}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {694, 164}} - {{0, 164}, {694, 216}} - - - - LauncherConfigVersion - 8 - PBXProjectModuleGUID - 1C162984064C10D400B95A72 - PBXProjectModuleLabel - Debug - GLUTExamples (Underwater) - - GeometryConfiguration - - DebugConsoleDrawerSize - {100, 120} - DebugConsoleVisible - None - DebugConsoleWindowFrame - {{200, 200}, {500, 300}} - DebugSTDIOWindowFrame - {{200, 200}, {500, 300}} - Frame - {{0, 0}, {694, 380}} - RubberWindowFrame - 321 238 694 422 0 0 1440 878 - - Module - PBXDebugSessionModule - Proportion - 100% - - - Proportion - 100% - - - Name - Debugger - ServiceClasses - - PBXDebugSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CD10A99069EF8BA00B06720 - 1C0AD2AB069F1E9B00FABCE6 - 1C162984064C10D400B95A72 - 1C0AD2AC069F1E9B00FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.debug - WindowString - 321 238 694 422 0 0 1440 878 - WindowToolGUID - 1CD10A99069EF8BA00B06720 - WindowToolIsVisible - 0 - - - FirstTimeWindowDisplayed - - Identifier - windowTool.find - IsVertical - - Layout - - - Dock - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CDD528C0622207200134675 - PBXProjectModuleLabel - IOHIDLib.h - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {781, 212}} - RubberWindowFrame - 31 477 781 470 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 781pt - - - Proportion - 212pt - - - BecomeActive - - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528E0623707200166675 - PBXProjectModuleLabel - Project Find - - GeometryConfiguration - - Frame - {{0, 217}, {781, 212}} - RubberWindowFrame - 31 477 781 470 0 0 1280 1002 - - Module - PBXProjectFindModule - Proportion - 212pt - - - Proportion - 429pt - - - Name - Project Find - ServiceClasses - - PBXProjectFindModule - - StatusbarIsVisible - - TableOfContents - - 1C530D57069F1CE1000CFCEE - 3BCF4DD2097DA7030049C083 - 3BCF4DD3097DA7030049C083 - 1CDD528C0622207200134675 - 1CD0528E0623707200166675 - - WindowString - 31 477 781 470 0 0 1280 1002 - WindowToolGUID - 1C530D57069F1CE1000CFCEE - WindowToolIsVisible - - - - Identifier - MENUSEPARATOR - - - Identifier - windowTool.debuggerConsole - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAAC065D492600B07095 - PBXProjectModuleLabel - Debugger Console - - GeometryConfiguration - - Frame - {{0, 0}, {440, 358}} - RubberWindowFrame - 650 41 440 400 0 0 1280 1002 - - Module - PBXDebugCLIModule - Proportion - 358pt - - - Proportion - 358pt - - - Name - Debugger Console - ServiceClasses - - PBXDebugCLIModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAAD065D492600B07095 - 1C78EAAE065D492600B07095 - 1C78EAAC065D492600B07095 - - WindowString - 650 41 440 400 0 0 1280 1002 - - - Identifier - windowTool.run - Layout - - - Dock - - - ContentConfiguration - - LauncherConfigVersion - 3 - PBXProjectModuleGUID - 1CD0528B0623707200166675 - PBXProjectModuleLabel - Run - Runner - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {493, 167}} - {{0, 176}, {493, 267}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {405, 443}} - {{414, 0}, {514, 443}} - - - - - GeometryConfiguration - - Frame - {{0, 0}, {460, 159}} - RubberWindowFrame - 316 696 459 200 0 0 1280 1002 - - Module - PBXRunSessionModule - Proportion - 159pt - - - Proportion - 159pt - - - Name - Run Log - ServiceClasses - - PBXRunSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C0AD2B3069F1EA900FABCE6 - 1C0AD2B4069F1EA900FABCE6 - 1CD0528B0623707200166675 - 1C0AD2B5069F1EA900FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.run - WindowString - 316 696 459 200 0 0 1280 1002 - WindowToolGUID - 1C0AD2B3069F1EA900FABCE6 - WindowToolIsVisible - 0 - - - Identifier - windowTool.scm - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAB2065D492600B07095 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1C78EAB3065D492600B07095 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {452, 0}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD052920623707200166675 - PBXProjectModuleLabel - SCM - - GeometryConfiguration - - ConsoleFrame - {{0, 259}, {452, 0}} - Frame - {{0, 7}, {452, 259}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - TableConfiguration - - Status - 30 - FileName - 199 - Path - 197.09500122070312 - - TableFrame - {{0, 0}, {452, 250}} - - Module - PBXCVSModule - Proportion - 262pt - - - Proportion - 266pt - - - Name - SCM - ServiceClasses - - PBXCVSModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAB4065D492600B07095 - 1C78EAB5065D492600B07095 - 1C78EAB2065D492600B07095 - 1CD052920623707200166675 - - ToolbarConfiguration - xcode.toolbar.config.scm - WindowString - 743 379 452 308 0 0 1280 1002 - - - Identifier - windowTool.breakpoints - IsVertical - - Layout - - - Dock - - - BecomeActive - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C77FABC04509CD000000102 - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - no - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 168 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 1C77FABC04509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {168, 350}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - - GeometryConfiguration - - Frame - {{0, 0}, {185, 368}} - GroupTreeTableConfiguration - - MainColumn - 168 - - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 185pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA1AED706398EBD00589147 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{190, 0}, {554, 368}} - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - XCDetailModule - Proportion - 554pt - - - Proportion - 368pt - - - MajorVersion - 2 - MinorVersion - 0 - Name - Breakpoints - ServiceClasses - - PBXSmartGroupTreeModule - XCDetailModule - - StatusbarIsVisible - - TableOfContents - - 1CDDB66807F98D9800BB5817 - 1CDDB66907F98D9800BB5817 - 1CE0B1FE06471DED0097A5F4 - 1CA1AED706398EBD00589147 - - ToolbarConfiguration - xcode.toolbar.config.breakpoints - WindowString - 315 424 744 409 0 0 1440 878 - WindowToolGUID - 1CDDB66807F98D9800BB5817 - WindowToolIsVisible - - - - Identifier - windowTool.debugAnimator - Layout - - - Dock - - - Module - PBXNavigatorGroup - Proportion - 100% - - - Proportion - 100% - - - Name - Debug Visualizer - ServiceClasses - - PBXNavigatorGroup - - StatusbarIsVisible - - ToolbarConfiguration - xcode.toolbar.config.debugAnimator - WindowString - 100 100 700 500 0 0 1280 1002 - - - Identifier - windowTool.bookmarks - Layout - - - Dock - - - Module - PBXBookmarksModule - Proportion - 100% - - - Proportion - 100% - - - Name - Bookmarks - ServiceClasses - - PBXBookmarksModule - - StatusbarIsVisible - 0 - WindowString - 538 42 401 187 0 0 1280 1002 - - - Identifier - windowTool.classBrowser - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - OptionsSetName - Hierarchy, all classes - PBXProjectModuleGUID - 1CA6456E063B45B4001379D8 - PBXProjectModuleLabel - Class Browser - NSObject - - GeometryConfiguration - - ClassesFrame - {{0, 0}, {374, 96}} - ClassesTreeTableConfiguration - - PBXClassNameColumnIdentifier - 208 - PBXClassBookColumnIdentifier - 22 - - Frame - {{0, 0}, {630, 331}} - MembersFrame - {{0, 105}, {374, 395}} - MembersTreeTableConfiguration - - PBXMemberTypeIconColumnIdentifier - 22 - PBXMemberNameColumnIdentifier - 216 - PBXMemberTypeColumnIdentifier - 97 - PBXMemberBookColumnIdentifier - 22 - - PBXModuleWindowStatusBarHidden2 - 1 - RubberWindowFrame - 385 179 630 352 0 0 1440 878 - - Module - PBXClassBrowserModule - Proportion - 332pt - - - Proportion - 332pt - - - Name - Class Browser - ServiceClasses - - PBXClassBrowserModule - - StatusbarIsVisible - 0 - TableOfContents - - 1C0AD2AF069F1E9B00FABCE6 - 1C0AD2B0069F1E9B00FABCE6 - 1CA6456E063B45B4001379D8 - - ToolbarConfiguration - xcode.toolbar.config.classbrowser - WindowString - 385 179 630 352 0 0 1440 878 - WindowToolGUID - 1C0AD2AF069F1E9B00FABCE6 - WindowToolIsVisible - 0 - - - - diff --git a/Feedback360/Feedback360.xcodeproj/project.pbxproj b/Feedback360/Feedback360.xcodeproj/project.pbxproj deleted file mode 100644 index c013829..0000000 --- a/Feedback360/Feedback360.xcodeproj/project.pbxproj +++ /dev/null @@ -1,285 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 45; - objects = { - -/* Begin PBXBuildFile section */ - 3B2EF54C0965C358007BFB7B /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2EF54B0965C358007BFB7B /* ForceFeedback.framework */; }; - 3BBA037D09697D80008A46C9 /* emulator.c in Sources */ = {isa = PBXBuildFile; fileRef = 3BBA037C09697D80008A46C9 /* emulator.c */; }; - 3BBA03D0096A22F5008A46C9 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BBA03CF096A22F5008A46C9 /* IOKit.framework */; }; - 3BBA03E3096A29B5008A46C9 /* devlink.c in Sources */ = {isa = PBXBuildFile; fileRef = 3BBA03E2096A29B5008A46C9 /* devlink.c */; }; - 8D576312048677EA00EA77CD /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB77B6FE84183AC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; - 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */; }; - 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8D5B49A704867FD3000E48DA /* InfoPlist.strings */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 08FB77B6FE84183AC02AAC07 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; - 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 3B2EF5440965B3C7007BFB7B /* main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main.h; sourceTree = ""; }; - 3B2EF54B0965C358007BFB7B /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 3BBA037B09697D80008A46C9 /* emulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emulator.h; sourceTree = ""; }; - 3BBA037C09697D80008A46C9 /* emulator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = emulator.c; sourceTree = ""; }; - 3BBA03CF096A22F5008A46C9 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 3BBA03E1096A29B5008A46C9 /* devlink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = devlink.h; sourceTree = ""; }; - 3BBA03E2096A29B5008A46C9 /* devlink.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = devlink.c; sourceTree = ""; }; - 8D576316048677EA00EA77CD /* Feedback360.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Feedback360.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D576317048677EA00EA77CD /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D576313048677EA00EA77CD /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D576314048677EA00EA77CD /* CoreFoundation.framework in Frameworks */, - 3B2EF54C0965C358007BFB7B /* ForceFeedback.framework in Frameworks */, - 3BBA03D0096A22F5008A46C9 /* IOKit.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* Feedback360 */ = { - isa = PBXGroup; - children = ( - 08FB77AFFE84173DC02AAC07 /* Source */, - 089C167CFE841241C02AAC07 /* Resources */, - 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */, - 19C28FB6FE9D52B211CA2CBB /* Products */, - ); - name = Feedback360; - sourceTree = ""; - }; - 089C1671FE841209C02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 3BBA03CF096A22F5008A46C9 /* IOKit.framework */, - 3B2EF54B0965C358007BFB7B /* ForceFeedback.framework */, - 0AA1909FFE8422F4C02AAC07 /* CoreFoundation.framework */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 3B2EF5470965B8E3007BFB7B /* New Group */, - ); - name = Resources; - sourceTree = ""; - }; - 08FB77AFFE84173DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 3B2EF5440965B3C7007BFB7B /* main.h */, - 08FB77B6FE84183AC02AAC07 /* main.c */, - 3BBA037B09697D80008A46C9 /* emulator.h */, - 3BBA037C09697D80008A46C9 /* emulator.c */, - 3BBA03E1096A29B5008A46C9 /* devlink.h */, - 3BBA03E2096A29B5008A46C9 /* devlink.c */, - ); - name = Source; - sourceTree = ""; - }; - 19C28FB6FE9D52B211CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D576316048677EA00EA77CD /* Feedback360.bundle */, - ); - name = Products; - sourceTree = ""; - }; - 3B2EF5470965B8E3007BFB7B /* New Group */ = { - isa = PBXGroup; - children = ( - 8D576317048677EA00EA77CD /* Info.plist */, - 8D5B49A704867FD3000E48DA /* InfoPlist.strings */, - ); - name = "New Group"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D57630D048677EA00EA77CD /* Feedback360 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3BBDC69309793BF60023AAD8 /* Build configuration list for PBXNativeTarget "Feedback360" */; - buildPhases = ( - 8D57630F048677EA00EA77CD /* Resources */, - 8D576311048677EA00EA77CD /* Sources */, - 8D576313048677EA00EA77CD /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Feedback360; - productInstallPath = "$(HOME)/Library/Bundles"; - productName = Feedback360; - productReference = 8D576316048677EA00EA77CD /* Feedback360.bundle */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 3BBDC69709793BF60023AAD8 /* Build configuration list for PBXProject "Feedback360" */; - compatibilityVersion = "Xcode 2.4"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 089C166AFE841209C02AAC07 /* Feedback360 */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D57630D048677EA00EA77CD /* Feedback360 */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D57630F048677EA00EA77CD /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D576311048677EA00EA77CD /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D576312048677EA00EA77CD /* main.c in Sources */, - 3BBA037D09697D80008A46C9 /* emulator.c in Sources */, - 3BBA03E3096A29B5008A46C9 /* devlink.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 8D5B49A704867FD3000E48DA /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 3BBDC69409793BF60023AAD8 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PRODUCT_NAME = Feedback360; - WRAPPER_EXTENSION = bundle; - ZERO_LINK = YES; - }; - name = Development; - }; - 3BBDC69509793BF60023AAD8 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PRODUCT_NAME = Feedback360; - WRAPPER_EXTENSION = bundle; - ZERO_LINK = NO; - }; - name = Deployment; - }; - 3BBDC69609793BF60023AAD8 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/Bundles"; - PRODUCT_NAME = Feedback360; - WRAPPER_EXTENSION = bundle; - }; - name = Default; - }; - 3BBDC69809793BF60023AAD8 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Development; - }; - 3BBDC69909793BF60023AAD8 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Deployment; - }; - 3BBDC69A09793BF60023AAD8 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3BBDC69309793BF60023AAD8 /* Build configuration list for PBXNativeTarget "Feedback360" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3BBDC69409793BF60023AAD8 /* Development */, - 3BBDC69509793BF60023AAD8 /* Deployment */, - 3BBDC69609793BF60023AAD8 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 3BBDC69709793BF60023AAD8 /* Build configuration list for PBXProject "Feedback360" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3BBDC69809793BF60023AAD8 /* Development */, - 3BBDC69909793BF60023AAD8 /* Deployment */, - 3BBDC69A09793BF60023AAD8 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/Feedback360/Feedback360Effect.cpp b/Feedback360/Feedback360Effect.cpp new file mode 100644 index 0000000..87d4fe0 --- /dev/null +++ b/Feedback360/Feedback360Effect.cpp @@ -0,0 +1,277 @@ +/* + MICE Xbox 360 Controller driver for Mac OS X + Force Feedback module + Copyright (C) 2013 David Ryskalczyk + Based on xi, Copyright (C) 2011 Masahiko Morii + + Feedback360Effect.cpp - Main code for the FF plugin + + This file is part of Xbox360Controller. + + Xbox360Controller is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Xbox360Controller is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Xbox360Controller; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "Feedback360Effect.h" +using std::max; +using std::min; + +//---------------------------------------------------------------------------------------------- +// CEffect +//---------------------------------------------------------------------------------------------- +Feedback360Effect::Feedback360Effect() : Type(NULL), Status(0), PlayCount(0), +StartTime(0), Index(0), LastTime(0), Handle(0), DiEffect({0}), DiEnvelope({0}), +DiCustomForce({0}), DiConstantForce({0}), DiPeriodic({0}), DiRampforce({0}) +{ + +} + +Feedback360Effect::Feedback360Effect(FFEffectDownloadID theHand) : Feedback360Effect() +{ + Handle = theHand; +} + +Feedback360Effect::Feedback360Effect(const Feedback360Effect &src) : Type(src.Type), +Handle(src.Handle), Status(src.Status), PlayCount(src.PlayCount), +StartTime(src.StartTime), Index(src.Index), LastTime(src.LastTime) +{ + memcpy(&DiEffect, &src.DiEffect, sizeof(FFEFFECT)); + memcpy(&DiEnvelope, &src.DiEnvelope, sizeof(FFENVELOPE)); + memcpy(&DiCustomForce, &src.DiCustomForce, sizeof(FFCUSTOMFORCE)); + memcpy(&DiConstantForce, &src.DiConstantForce, sizeof(FFCONSTANTFORCE)); + memcpy(&DiPeriodic, &src.DiPeriodic, sizeof(FFPERIODIC)); + memcpy(&DiRampforce, &src.DiRampforce, sizeof(FFRAMPFORCE)); +} + +//---------------------------------------------------------------------------------------------- +// Calc +//---------------------------------------------------------------------------------------------- +LONG Feedback360Effect::Calc(LONG *LeftLevel, LONG *RightLevel) +{ + CFTimeInterval Duration = 0; + if(DiEffect.dwDuration != FF_INFINITE) { + Duration = max(1., DiEffect.dwDuration / 1000.) / 1000.; + } else { + Duration = DBL_MAX; + } + double BeginTime = StartTime + ( DiEffect.dwStartDelay / 1000. / 1000.); + double EndTime = DBL_MAX; + if (PlayCount != -1) + { + EndTime = BeginTime + Duration * PlayCount; + } + double CurrentTime = CurrentTimeUsingMach(); + + if (Status == FFEGES_PLAYING && BeginTime <= CurrentTime && CurrentTime <= EndTime) + { + // Used for force calculation + LONG NormalLevel; + LONG WorkLeftLevel; + LONG WorkRightLevel; + + // Used for envelope calculation + LONG NormalRate; + LONG AttackLevel; + LONG FadeLevel; + + CalcEnvelope((ULONG)(Duration*1000) + ,(ULONG)(fmod(CurrentTime - BeginTime, Duration)*1000) + ,&NormalRate + ,&AttackLevel + ,&FadeLevel); + + // CustomForce allows setting each channel separately + if(CFEqual(Type, kFFEffectType_CustomForce_ID)) { + if((CurrentTimeUsingMach() - LastTime)*1000*1000 < DiCustomForce.dwSamplePeriod) { + return -1; + } + else { + WorkLeftLevel = ((DiCustomForce.rglForceData[2*Index] * NormalRate + AttackLevel + FadeLevel) / 100) * DiEffect.dwGain / 10000; + WorkRightLevel = ((DiCustomForce.rglForceData[2*Index + 1] * NormalRate + AttackLevel + FadeLevel) / 100) * DiEffect.dwGain / 10000; + //fprintf(stderr, "L:%d; R:%d\n", WorkLeftLevel, WorkRightLevel); + Index = (Index + 1) % (DiCustomForce.cSamples/2); + LastTime = CurrentTimeUsingMach(); + } + } + // Regular commands treat controller as a single output (both channels are together as one) + else { + CalcForce( + (ULONG)(Duration*1000) + ,(ULONG)(fmod(CurrentTime - BeginTime, Duration)*1000) + ,NormalRate + ,AttackLevel + ,FadeLevel + ,&NormalLevel ); + //fprintf(stderr, "DeltaT %f\n", CurrentTime - BeginTime); + //fprintf(stderr, "Duration %f; NormalRate: %d; AttackLevel: %d; FadeLevel: %d\n", Duration, NormalRate, AttackLevel, FadeLevel); + + WorkLeftLevel = (NormalLevel > 0) ? NormalLevel : -NormalLevel; + WorkRightLevel = (NormalLevel > 0) ? NormalLevel : -NormalLevel; + } + WorkLeftLevel = min( SCALE_MAX, WorkLeftLevel * SCALE_MAX / 10000 ); + WorkRightLevel = min( SCALE_MAX, WorkRightLevel * SCALE_MAX / 10000 ); + + *LeftLevel = *LeftLevel + WorkLeftLevel; + *RightLevel = *RightLevel + WorkRightLevel; + } + return 0; +} + +//---------------------------------------------------------------------------------------------- +// CalcEnvelope +//---------------------------------------------------------------------------------------------- +void Feedback360Effect::CalcEnvelope(ULONG Duration, ULONG CurrentPos, LONG *NormalRate, LONG *AttackLevel, LONG *FadeLevel) +{ + if( ( DiEffect.dwFlags & FFEP_ENVELOPE ) && DiEffect.lpEnvelope != NULL ) + { + // Calculate attack factor + LONG AttackRate = 0; + ULONG AttackTime = max( (DWORD)1, DiEnvelope.dwAttackTime / 1000 ); + if (CurrentPos < AttackTime) + { + AttackRate = ( AttackTime - CurrentPos ) * 100 / AttackTime; + } + + // Calculate fade factor + LONG FadeRate = 0; + ULONG FadeTime = max( (DWORD)1, DiEnvelope.dwFadeTime / 1000 ); + ULONG FadePos = Duration - FadeTime; + if (FadePos < CurrentPos) + { + FadeRate = ( CurrentPos - FadePos ) * 100 / FadeTime; + } + + *NormalRate = 100 - AttackRate - FadeRate; + *AttackLevel = DiEnvelope.dwAttackLevel * AttackRate; + *FadeLevel = DiEnvelope.dwFadeLevel * FadeRate; + } else { + *NormalRate = 100; + *AttackLevel = 0; + *FadeLevel = 0; + } +} + +void Feedback360Effect::CalcForce(ULONG Duration, ULONG CurrentPos, LONG NormalRate, LONG AttackLevel, LONG FadeLevel, LONG * NormalLevel) +{ + LONG Magnitude = 0; + LONG Period; + LONG R; + LONG Rate; + + if (CFEqual(Type, kFFEffectType_ConstantForce_ID)) { + Magnitude = DiConstantForce.lMagnitude; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + } + else if (CFEqual(Type, kFFEffectType_Square_ID)) { + Period = max( (DWORD)1, ( DiPeriodic.dwPeriod / 1000 ) ); + R = ( CurrentPos%Period) * 360 / Period; + R = ( R + ( DiPeriodic.dwPhase / 100 ) ) % 360; + + Magnitude = DiPeriodic.dwMagnitude; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + + if (180 <= R) + { + Magnitude = Magnitude * -1; + } + + Magnitude = Magnitude + DiPeriodic.lOffset; + } + else if (CFEqual(Type, kFFEffectType_Sine_ID)) { + Period = max( (DWORD)1, ( DiPeriodic.dwPeriod / 1000 ) ); + R = (CurrentPos%Period) * 360 / Period; + R = ( R + ( DiPeriodic.dwPhase / 100 ) ) % 360; + + Magnitude = DiPeriodic.dwMagnitude; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + + Magnitude = ( int)( Magnitude * sin( R * M_PI / 180.0 ) ); + + Magnitude = Magnitude + DiPeriodic.lOffset; + } + else if (CFEqual(Type, kFFEffectType_Triangle_ID)) { + Period = max( (DWORD)1, ( DiPeriodic.dwPeriod / 1000 ) ); + R = (CurrentPos%Period) * 360 / Period; + R = ( R + ( DiPeriodic.dwPhase / 100 ) ) % 360; + + Magnitude = DiPeriodic.dwMagnitude; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + + if (0 <= R && R < 90) + { + Magnitude = -Magnitude * ( 90 - R ) / 90; + } + if (90 <= R && R < 180) + { + Magnitude = Magnitude * ( R - 90 ) / 90; + } + if (180 <= R && R < 270) + { + Magnitude = Magnitude * ( 90 - ( R - 180 ) ) / 90; + } + if (270 <= R && R < 360) + { + Magnitude = -Magnitude * ( R - 270 ) / 90; + } + + Magnitude = Magnitude + DiPeriodic.lOffset; + } + else if(CFEqual(Type, kFFEffectType_SawtoothUp_ID)) { + Period = max( (DWORD)1, ( DiPeriodic.dwPeriod / 1000 ) ); + R = (CurrentPos%Period) * 360 / Period; + R = ( R + ( DiPeriodic.dwPhase / 100 ) ) % 360; + + Magnitude = DiPeriodic.dwMagnitude; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + + if (0 <= R && R < 180) + { + Magnitude = -Magnitude * ( 180 - R ) / 180; + } + if (180 <= R && R < 360) + { + Magnitude = Magnitude * ( R - 180 ) / 180; + } + + Magnitude = Magnitude + DiPeriodic.lOffset; + } + else if (CFEqual(Type, kFFEffectType_SawtoothDown_ID)) { + Period = max( (DWORD)1, ( DiPeriodic.dwPeriod / 1000 ) ); + R = (CurrentPos%Period) * 360 / Period; + R = ( R + ( DiPeriodic.dwPhase / 100 ) ) % 360; + + Magnitude = DiPeriodic.dwMagnitude; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + if( 0 <= R && R < 180 ) + { + Magnitude = Magnitude * ( 180 - R ) / 180; + } + if( 180 <= R && R < 360 ) + { + Magnitude = -Magnitude * ( R - 180 ) / 180; + } + + Magnitude = Magnitude + DiPeriodic.lOffset; + } + else if (CFEqual(Type, kFFEffectType_RampForce_ID)) { + Rate = ( Duration - CurrentPos ) * 100 + / Duration;//MAX( 1, DiEffect.dwDuration / 1000 ); + + Magnitude = ( DiRampforce.lStart * Rate + + DiRampforce.lEnd * ( 100 - Rate ) ) / 100; + Magnitude = ( Magnitude * NormalRate + AttackLevel + FadeLevel ) / 100; + } + + *NormalLevel = Magnitude * (LONG)DiEffect.dwGain / 10000; +} diff --git a/Feedback360/Feedback360Effect.h b/Feedback360/Feedback360Effect.h new file mode 100644 index 0000000..c63573a --- /dev/null +++ b/Feedback360/Feedback360Effect.h @@ -0,0 +1,89 @@ +/* + MICE Xbox 360 Controller driver for Mac OS X + Force Feedback module + Copyright (C) 2013 David Ryskalczyk + based on xi, Copyright (C) 2011 Masahiko Morii + + Feedback360Effect.cpp - Main code for the FF plugin + + This file is part of Xbox360Controller. + + Xbox360Controller is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Xbox360Controller is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Xbox360Controller; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +// Force Feedback Driver for XInput + +#ifndef Feedback360_Feedback360Effect_h +#define Feedback360_Feedback360Effect_h + +#include +#include +#include +#include +#include + +//---------------------------------------------------------------------------------------------- +// Effects +//---------------------------------------------------------------------------------------------- + +#define CONSTANT_FORCE 0x00 +#define RAMP_FORCE 0x01 +#define SQUARE 0x02 +#define SINE 0x03 +#define TRIANGLE 0x04 +#define SAWTOOTH_UP 0x05 +#define SAWTOOTH_DOWN 0x06 +#define SPRING 0x07 +#define DAMPER 0x08 +#define INERTIA 0x09 +#define FRICTION 0x0A +#define CUSTOM_FORCE 0x0B + +#define SCALE_MAX (LONG)255 + +double CurrentTimeUsingMach(); + +class Feedback360Effect +{ +public: + Feedback360Effect(FFEffectDownloadID theHand); + Feedback360Effect(const Feedback360Effect &src); + + LONG Calc(LONG *LeftLevel, LONG *RightLevel); + + CFUUIDRef Type; + FFEffectDownloadID Handle; + + FFEFFECT DiEffect; + FFENVELOPE DiEnvelope; + FFCONSTANTFORCE DiConstantForce; + FFCUSTOMFORCE DiCustomForce; + FFPERIODIC DiPeriodic; + FFRAMPFORCE DiRampforce; + + DWORD Status; + DWORD PlayCount; + double StartTime; + + double LastTime; + DWORD Index; + +private: + Feedback360Effect(); + void CalcEnvelope(ULONG Duration, ULONG CurrentPos, LONG *NormalRate, LONG *AttackLevel, LONG *FadeLevel); + void CalcForce(ULONG Duration, ULONG CurrentPos, LONG NormalRate, LONG AttackLevel, LONG FadeLevel, LONG * NormalLevel); +}; + +#endif diff --git a/Feedback360/Info.plist b/Feedback360/Info.plist index 0d8f5c1..5e1ff4a 100644 --- a/Feedback360/Info.plist +++ b/Feedback360/Info.plist @@ -6,18 +6,18 @@ English CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - CFBundleIdentifier com.mice.Xbox360ControllerForceFeedback CFBundleInfoDictionaryVersion 6.0 + CFBundleName + ${PRODUCT_NAME} CFBundlePackageType BNDL CFBundleSignature ???? CFBundleVersion - 1.0 + ${CURRENT_PROJECT_VERSION} CFPlugInDynamicRegistration NO CFPlugInFactories @@ -32,8 +32,6 @@ B8ED278F-EC8A-4E8E-B4CF-13E2A9D68E83 - CFBundleName - ${PRODUCT_NAME} NSHumanReadableCopyright Copyright © 2013 MICE Software. All rights reserved. diff --git a/Feedback360/devlink.c b/Feedback360/devlink.cpp similarity index 59% rename from Feedback360/devlink.c rename to Feedback360/devlink.cpp index d6a1e9d..d343a7e 100644 --- a/Feedback360/devlink.c +++ b/Feedback360/devlink.cpp @@ -20,25 +20,23 @@ along with Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include + +#include #include "devlink.h" // Initialise the link bool Device_Initialise(DeviceLink *link,io_object_t device) { - IOCFPlugInInterface **plugInInterface; - SInt32 score; - IOReturn ret; + IOCFPlugInInterface **plugInInterface = NULL; + SInt32 score = 0; + IOReturn ret = IOCreatePlugInInterfaceForService(device, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); - plugInInterface=NULL; - score=0; - ret=IOCreatePlugInInterfaceForService(device,kIOHIDDeviceUserClientTypeID,kIOCFPlugInInterfaceID,&plugInInterface,&score); - if(ret!=kIOReturnSuccess) return FALSE; - ret=(*plugInInterface)->QueryInterface(plugInInterface,CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID121),(LPVOID)&link->interface); + if (ret!=kIOReturnSuccess) return false; + ret=(*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID121), (LPVOID*)(&link->interface)); (*plugInInterface)->Release(plugInInterface); - if(ret!=kIOReturnSuccess) return FALSE; - (*link->interface)->open(link->interface,0); - return TRUE; + if (ret!=kIOReturnSuccess) return false; + (*link->interface)->open(link->interface, 0); + return true; } // Finish the link @@ -46,17 +44,21 @@ void Device_Finalise(DeviceLink *link) { (*link->interface)->close(link->interface); (*link->interface)->Release(link->interface); - link->interface=NULL; + link->interface = NULL; } // Send a report via the link bool Device_Send(DeviceLink *link,void *data,int length) { - if(link->interface==NULL) return FALSE; + if(link->interface==NULL) { + fprintf(stderr, "Attempting to send to a closed link!\n"); + return false; + } else { + //fprintf(stderr, "Attempting to send: %d %d %d %d\n",((unsigned char*)data)[0], ((unsigned char*)data)[1], ((unsigned char*)data)[2], ((unsigned char*)data)[3]); IOReturn res=(*link->interface)->setReport(link->interface,kIOHIDReportTypeOutput,0,data,length,10000,NULL,NULL,NULL); - if (res != kIOReturnSuccess) - fprintf(stderr, "Device_Send failed: 0x%.8x\n", res); - return res==kIOReturnSuccess; + if (res != kIOReturnSuccess) + fprintf(stderr, "Device_Send failed: 0x%.8x\n", res); + return res == kIOReturnSuccess; } } diff --git a/Feedback360/devlink.h b/Feedback360/devlink.h index fadaf90..f620cd7 100644 --- a/Feedback360/devlink.h +++ b/Feedback360/devlink.h @@ -20,7 +20,10 @@ along with Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include +#ifndef Feedback360_devlink_h +#define Feedback360_devlink_h + +#include #include typedef struct { @@ -31,3 +34,5 @@ bool Device_Initialise(DeviceLink *link,io_object_t device); void Device_Finalise(DeviceLink *link); bool Device_Send(DeviceLink *link,void *data,int length); + +#endif diff --git a/Feedback360/emulator.c b/Feedback360/emulator.c deleted file mode 100644 index 5d67675..0000000 --- a/Feedback360/emulator.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - MICE Xbox 360 Controller driver for Mac OS X - Copyright (C) 2006-2013 Colin Munro - - emulator.c - simulate a force feedback device - - This file is part of Xbox360Controller. - - Xbox360Controller is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Xbox360Controller is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Foobar; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include "emulator.h" - -/* - * This code could do with being improved. For example, the two motors could - * allow for a "left" and "right" rumble in a car game. - * - * For debugging, you may use fprintf(stderr,...). The output will appear on - * the console of whatever game is using the Apple Force Feedback Framework. - */ - -#define LoopGranularity 500 // Microseconds -#define LoopTimerDelay (LoopGranularity*0.000001f) // In seconds - -static void Emulate_Timer(CFRunLoopTimerRef timer,void *context); - -// Initialise the emulation of a force feedback device -void Emulate_Initialise(ForceEmulator *emulator,int effectCount,void (*SetForce)(void*,unsigned char,unsigned char),void *context) -{ - int i; - CFRunLoopTimerContext callbackData; - - // Set callback - emulator->SetForce=SetForce; - emulator->context=context; - // Create effects memory - emulator->effects=(ForceEffect*)malloc(sizeof(ForceEffect)*effectCount); - emulator->effectCount=effectCount; - // Defaults - emulator->enable=TRUE; - emulator->pause=FALSE; - emulator->gain=4; - emulator->maxGain=4; - emulator->activeEffect=-1; - // Reset - for(i=0;ieffects[i].inUse=FALSE; - // Launch timer - callbackData.version=0; - callbackData.info=emulator; - callbackData.retain=NULL; - callbackData.release=NULL; - callbackData.copyDescription=NULL; - emulator->timer=CFRunLoopTimerCreate(NULL,LoopTimerDelay,LoopTimerDelay,0,0,Emulate_Timer,&callbackData); - CFRunLoopAddTimer(CFRunLoopGetCurrent(),emulator->timer,kCFRunLoopCommonModes); -} - -// Close down the force feedback stuff -void Emulate_Finalise(ForceEmulator *emulator) -{ - CFRunLoopTimerInvalidate(emulator->timer); - CFRelease(emulator->timer); - free(emulator->effects); - emulator->SetForce(emulator->context,0,0); -} - -// Call the callback, if output is enabled -void Emulate_Callback(ForceEmulator *emulator,unsigned char large,unsigned char small) -{ - emulator->oldLarge=large; - emulator->oldSmall=small; - if(emulator->enable) emulator->SetForce(emulator->context,large,small); -} - -// Create an effect - for the FF API -int Emulate_CreateEffect(ForceEmulator *emulator,const ForceParams *params) -{ - int i; - - for(i=0;ieffectCount;i++) { - if(!emulator->effects[i].inUse) { - emulator->effects[i].inUse=TRUE; - if(!Emulate_ChangeEffect(emulator,i+1,params)) { - emulator->effects[i].inUse=FALSE; - return 0; - } - return i+1; - } - } - return 0; -} - -// Change an effect - for the FF API -bool Emulate_ChangeEffect(ForceEmulator *emulator,int index,const ForceParams *params) -{ - ForceEffect *effect=emulator->effects+index-1; - effect->gain=params->gain; - effect->maxLevel=params->maxLevel; - effect->startCount=params->startDelay/LoopGranularity; - effect->attackLevel=params->attackLevel; - effect->attackCount=params->attackTime/LoopGranularity; - effect->sustainLevel=params->sustainLevel; - effect->sustainCount=params->sustainTime/LoopGranularity; - effect->fadeLevel=params->fadeLevel; - effect->fadeCount=params->fadeTime/LoopGranularity; - return TRUE; -} - -// Destroy an effect - for the FF API -void Emulate_DestroyEffect(ForceEmulator *emulator,int index) -{ - emulator->effects[index-1].inUse=FALSE; - if(emulator->activeEffect==(index-1)) emulator->activeEffect=-1; -} - -// Returns true if the effect index is in use -bool Emulate_IsValidEffect(ForceEmulator *emulator,int index) -{ - if((index<1)||(index>emulator->effectCount)) return FALSE; - return emulator->effects[index-1].inUse; -} - -// Returns true if the effect index is playing -bool Emulate_IsPlaying(ForceEmulator *emulator,int index) -{ - return emulator->activeEffect==(index-1); -} - -// Returns true if the device has no effects -bool Emulate_IsEmpty(ForceEmulator *emulator) -{ - int i; - - for(i=0;ieffectCount;i++) - if(emulator->effects[i].inUse) - return FALSE; - return TRUE; -} - -// Resets the device -void Emulate_Reset(ForceEmulator *emulator) -{ - int i; - - for(i=0;ieffectCount;i++) emulator->effects[i].inUse=FALSE; - Emulate_Callback(emulator,0,0); -} - -// Starts an effect for the specified number of loops -void Emulate_Start(ForceEmulator *emulator,int index,int iterations) -{ - ForceEffect *effect; - -// fprintf(stderr,"Emulate_Start(%p,%i,%i)\n",emulator,index,iterations); - effect=emulator->effects+index-1; - effect->countStart=effect->startCount; - effect->countAttack=effect->attackCount; - effect->countSustain=effect->sustainCount; - effect->countFade=effect->fadeCount; - effect->countLoop=iterations; - emulator->activeEffect=index-1; -} - -// Stops an effect -void Emulate_Stop(ForceEmulator *emulator,int index) -{ -// fprintf(stderr,"Emulate_Stop(%p,%i)\n",emulator,index); - if((index-1)==emulator->activeEffect) { - emulator->activeEffect=-1; - Emulate_Callback(emulator,0,0); - } -} - -// Returns true if no effects are running -bool Emulate_IsStopped(ForceEmulator *emulator) -{ - return emulator->activeEffect==-1; -} - -// Returns the number of used effects -UInt32 Emulate_Effects_Used(ForceEmulator *emulator) -{ - int i,j; - - for(i=j=0;ieffectCount;i++) - if(emulator->effects[i].inUse) - j++; - return j; -} - -// Returns the number of possible effects -UInt32 Emulate_Effects_Total(ForceEmulator *emulator) -{ - return emulator->effectCount; -} - -// Enables or disables the force feedback -void Emulate_SetEnable(ForceEmulator *emulator,bool enable) -{ - bool old=emulator->enable; - // Stop motors in case they were running - if(old&&(!enable)) Emulate_Callback(emulator,0,0); - emulator->enable=enable; - // Resume motors at last computed value, as we'll have - // been computing new values for them even if disabled - if((!old)&&enable) Emulate_Callback(emulator,emulator->oldLarge,emulator->oldSmall); -} - -// Returns true if enabled -bool Emulate_IsEnabled(ForceEmulator *emulator) -{ - return emulator->enable; -} - -// Pauses the device -void Emulate_SetPaused(ForceEmulator *emulator,bool enable) -{ - bool old=emulator->pause; - // Stop motors in case they were running - if((!old)&&enable) Emulate_Callback(emulator,0,0); - emulator->pause=enable; - // Resume motors at last computed value, as we'll be - // resuming feedback effects where we left off. - if(old&&(!enable)) Emulate_Callback(emulator,emulator->oldLarge,emulator->oldSmall); -} - -// Returns true if paused -bool Emulate_IsPaused(ForceEmulator *emulator) -{ - return emulator->pause; -} - -// Sets the gain for the device -void Emulate_SetGain(ForceEmulator *emulator,int gain,int gainMax) -{ - if((emulator->gain<=0)||(emulator->maxGain<=0)) return; - emulator->gain=gain; - emulator->maxGain=gainMax; - while(emulator->maxGain<4) { - emulator->gain*=2; - emulator->maxGain*=2; - } -} - -// Utility - scales a value -static inline int Emulate_Scale(int from,int to,int max,int val) -{ - int upper=max-1; - return from+(((to-from)*(upper-val))/upper); -} - -// Utility - computes the values for the large and small motors from the effect -static void Emulate_Force(ForceEmulator *emulator,int force,int maxGain) -{ - int adjusted; - int bling; - int small,large; - -// fprintf(stderr,"Emulate_Force(%p,%i)\n",emulator,force); - adjusted=(force*emulator->gain)/emulator->maxGain; - bling=maxGain/4; - if(adjustedactiveEffect; - if((i==-1)||emulator->pause) return; - effect=emulator->effects+emulator->activeEffect; - // Process each counter on the effect, to see what's happening - if(effect->countStart>0) { - // In the start (pre-effect) stage - level=effect->attackLevel; - effect->countStart--; - } else { - if(effect->countAttack>0) { - // In the attack stage - level=Emulate_Scale(effect->attackLevel,effect->sustainLevel,effect->attackCount,effect->countAttack); - effect->countAttack--; - } else { - if(effect->countSustain>0) { - // In the sustain stage - level=effect->sustainLevel; - effect->countSustain--; - } else { - if(effect->countFade>0) { - // In the fade stage - level=Emulate_Scale(effect->sustainLevel,effect->fadeLevel,effect->fadeCount,effect->countFade); - effect->countFade--; - } else { - // Work out if we need to do it again - effect->countLoop--; - if(effect->countLoop>0) { - // Prepare for next loop - level=effect->attackLevel; - effect->countStart=effect->startCount; - effect->countAttack=effect->attackCount; - effect->countSustain=effect->sustainCount; - effect->countFade=effect->fadeCount; - } else { - // Effect finished - level=0; - emulator->activeEffect=-1; - } - } - } - } - } - // Actually calculate what to do for the effect - Emulate_Force(emulator,(level*effect->gain)/effect->maxLevel,effect->maxLevel); -} diff --git a/Feedback360/emulator.h b/Feedback360/emulator.h deleted file mode 100644 index 5c20998..0000000 --- a/Feedback360/emulator.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - MICE Xbox 360 Controller driver for Mac OS X - Copyright (C) 2006-2013 Colin Munro - - emulator.h - Interface to fake FF API effects using rumble motors - - This file is part of Xbox360Controller. - - Xbox360Controller is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Xbox360Controller is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Foobar; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include - -typedef enum { - fsStop, - fsPlay, -} ForceState; - -typedef struct { - bool inUse; - ForceState state; - // Information - int gain; - int maxLevel; - int startCount; - int attackLevel; - int attackCount; - int sustainLevel; - int sustainCount; - int fadeLevel; - int fadeCount; - // Runtime - int countStart; - int countAttack; - int countSustain; - int countFade; - int countLoop; -} ForceEffect; - -typedef struct { - // Settings - int gain; // 0-maxLevel - int maxLevel; - int startDelay; // Microseconds - // Envelope for effect - int attackLevel; // 0-maxLevel - int attackTime; // Microseconds - int sustainLevel; // 0-maxLevel - int sustainTime; // Microseconds - int fadeLevel; // 0-maxLevel - int fadeTime; // Microseconds -} ForceParams; - -typedef struct { - // Callback - void (*SetForce)(void *context,unsigned char large,unsigned char small); - void *context; - // Options - int gain,maxGain; - bool enable,pause; - // Effect entries - ForceEffect *effects; - int effectCount; - // Runtime - CFRunLoopTimerRef timer; - unsigned char oldLarge,oldSmall; - int activeEffect; -} ForceEmulator; - -// Constructor/destructor -void Emulate_Initialise(ForceEmulator *emulator,int effectCount,void (*SetForce)(void*,unsigned char,unsigned char),void *context); -void Emulate_Finalise(ForceEmulator *emulator); - -// Options -void Emulate_SetGain(ForceEmulator *emulator,int gain,int gainMax); -void Emulate_SetEnable(ForceEmulator *emulator,bool enable); -bool Emulate_IsEnabled(ForceEmulator *emulator); -void Emulate_SetPaused(ForceEmulator *emulator,bool enable); -bool Emulate_IsPaused(ForceEmulator *emulator); - -// Using effects -int Emulate_CreateEffect(ForceEmulator *emulator,const ForceParams *params); -bool Emulate_ChangeEffect(ForceEmulator *emulator,int index,const ForceParams *params); -void Emulate_DestroyEffect(ForceEmulator *emulator,int index); - -bool Emulate_IsValidEffect(ForceEmulator *emulator,int index); -bool Emulate_IsPlaying(ForceEmulator *emulator,int index); - -bool Emulate_IsEmpty(ForceEmulator *emulator); - -void Emulate_Reset(ForceEmulator *emulator); - -void Emulate_Start(ForceEmulator *emulator,int index,int iterations); -void Emulate_Stop(ForceEmulator *emulator,int index); -bool Emulate_IsStopped(ForceEmulator *emulator); - -UInt32 Emulate_Effects_Used(ForceEmulator *emulator); -UInt32 Emulate_Effects_Total(ForceEmulator *emulator); - -// Callbacks -void Emulate_Callback(ForceEmulator *emulator,unsigned char large,unsigned char small); diff --git a/Feedback360/main.c b/Feedback360/main.c deleted file mode 100644 index b4917c1..0000000 --- a/Feedback360/main.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - MICE Xbox 360 Controller driver for Mac OS X - Copyright (C) 2006-2013 Colin Munro - - main.c - Main code for the FF plugin - - This file is part of Xbox360Controller. - - Xbox360Controller is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Xbox360Controller is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Foobar; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include -#include "main.h" - -static void dealloc360Feedback(Xbox360ForceFeedback *this); - -// IUnknown - -static HRESULT Feedback360QueryInterface(void *that,REFIID iid,LPVOID *ppv) -{ - Xbox360ForceFeedback *this=FFThis(that); - CFUUIDRef interface; - - interface=CFUUIDCreateFromUUIDBytes(NULL,iid); - // IOForceFeedbackDevice - if(CFEqual(interface,kIOForceFeedbackDeviceInterfaceID)) - *ppv=&this->iIOForceFeedbackDeviceInterface; - // IUnknown || IOCFPlugInInterface - else if(CFEqual(interface,IUnknownUUID)||CFEqual(interface,kIOCFPlugInInterfaceID)) - *ppv=&this->iIOCFPlugInInterface; - else - *ppv=NULL; - // Done - CFRelease(interface); - if((*ppv)==NULL) return E_NOINTERFACE; - else { - this->iIOCFPlugInInterface.pseudoVTable->AddRef(*ppv); - return S_OK; - } -} - -static ULONG Feedback360AddRef(void *that) -{ - Xbox360ForceFeedback *this=FFThis(that); - this->refCount++; - return this->refCount; -} - -static ULONG Feedback360Release(void *that) -{ - Xbox360ForceFeedback *this=FFThis(that); - this->refCount--; - if(this->refCount==0) { - dealloc360Feedback(this); - return 0; - } else return this->refCount; -} - -// IOCFPlugInInterface - -static IOReturn Feedback360Probe(void *that,CFDictionaryRef propertyTable,io_service_t service,SInt32 *order) -{ - if ((service==0) - || ((!IOObjectConformsTo(service,"Xbox360ControllerClass")) - && (!IOObjectConformsTo(service,"Wireless360Controller")))) return kIOReturnBadArgument; - return S_OK; -} - -static IOReturn Feedback360Start(void *that,CFDictionaryRef propertyTable,io_service_t service) -{ - return S_OK; -} - -static IOReturn Feedback360Stop(void *that) -{ - return S_OK; -} - -// IOForceFeedbackDevice - -static HRESULT Feedback360GetVersion(void *this,ForceFeedbackVersion *version) -{ - if((this==NULL)||(version==NULL)) return FFERR_INVALIDPARAM; - version->apiVersion.majorRev=kFFPlugInAPIMajorRev; - version->apiVersion.minorAndBugRev=kFFPlugInAPIMinorAndBugRev; - version->apiVersion.stage=kFFPlugInAPIStage; - version->apiVersion.nonRelRev=kFFPlugInAPINonRelRev; - version->plugInVersion.majorRev=FeedbackDriverVersionMajor; - version->plugInVersion.minorAndBugRev=FeedbackDriverVersionMinor; - version->plugInVersion.stage=FeedbackDriverVersionStage; - version->plugInVersion.nonRelRev=FeedbackDriverVersionNonRelRev; - return S_OK; -} - -static void Feedback360_Callback(void *that,unsigned char large,unsigned char small) -{ - Xbox360ForceFeedback *this=(Xbox360ForceFeedback*)that; - char buf[]={0x00,0x04,large,small}; - if(!this->manual) Device_Send(&this->device,buf,sizeof(buf)); -} - -static HRESULT Feedback360InitializeTerminate(void *that,NumVersion APIversion,io_object_t hidDevice,boolean_t begin) -{ - Xbox360ForceFeedback *this=FFThis(that); -// fprintf(stderr,"Feedback360InitializeTerminate(%p,[%i.%i.%i.%i],%p,%s)\n",this,APIversion.majorRev,APIversion.minorAndBugRev,APIversion.stage,APIversion.nonRelRev,hidDevice,begin?"true":"false"); - if(this==NULL) return FFERR_INVALIDPARAM; - if(begin) { -// fprintf(stderr,"Feedback: Initialising...\n"); - // Initialize - if(APIversion.majorRev!=kFFPlugInAPIMajorRev) - { -// fprintf(stderr,"Feedback: Invalid version\n"); - return FFERR_INVALIDPARAM; - } - // From probe - if( (hidDevice==0) - || ((!IOObjectConformsTo(hidDevice,"Xbox360ControllerClass")) - && (!IOObjectConformsTo(hidDevice,"Wireless360Controller"))) ) - { -// fprintf(stderr,"Feedback: Invalid device\n"); - return FFERR_INVALIDPARAM; - } - Emulate_Initialise(&this->emulator,10,Feedback360_Callback,this); - if(!Device_Initialise(&this->device,hidDevice)) { -// fprintf(stderr,"Feedback: Failed to initialise\n"); - Emulate_Finalise(&this->emulator); - return FFERR_NOINTERFACE; - } - this->manual=FALSE; - } else { -// fprintf(stderr,"Feedback: Terminating\n"); - // Terminate - Emulate_Finalise(&this->emulator); - Device_Finalise(&this->device); - } - return FF_OK; -} - -static HRESULT Feedback360DestroyEffect(void *that,FFEffectDownloadID downloadID) -{ - Xbox360ForceFeedback *this=FFThis(that); - Emulate_DestroyEffect(&this->emulator,downloadID); - return FF_OK; -} - -static bool Feedback360SupportedEffect(CFUUIDRef effect) -{ - if(CFEqual(effect,kFFEffectType_SawtoothDown_ID)) return TRUE; - if(CFEqual(effect,kFFEffectType_SawtoothUp_ID)) return TRUE; - if(CFEqual(effect,kFFEffectType_Sine_ID)) return TRUE; - if(CFEqual(effect,kFFEffectType_Spring_ID)) return TRUE; - if(CFEqual(effect,kFFEffectType_Square_ID)) return TRUE; - if(CFEqual(effect,kFFEffectType_Triangle_ID)) return TRUE; - return FALSE; -} - -static bool Feedback360ConvertEffect(const FFEFFECT *effect,ForceParams *params) -{ - if((effect->cbTypeSpecificParams!=sizeof(FFPERIODIC))||(effect->lpvTypeSpecificParams==NULL)) return FALSE; - // Settings - params->startDelay=effect->dwStartDelay; - params->gain=effect->dwGain; - params->maxLevel=10000; - // Envelope - params->sustainLevel=((FFPERIODIC*)effect->lpvTypeSpecificParams)->dwMagnitude; - // Documentation was a bit confusing here as to which value was right, compared to what a game actually used -// params->sustainTime=effect->dwDuration; - params->sustainTime=((FFPERIODIC*)effect->lpvTypeSpecificParams)->dwPeriod; - if(effect->lpEnvelope==NULL) { - params->attackLevel=params->sustainLevel; - params->attackTime=0; - params->fadeLevel=params->sustainLevel; - params->fadeTime=0; - } else { - if(effect->lpEnvelope->dwSizeattackLevel=effect->lpEnvelope->dwAttackLevel; - params->attackTime=effect->lpEnvelope->dwAttackTime; - params->fadeLevel=effect->lpEnvelope->dwFadeLevel; - params->fadeTime=effect->lpEnvelope->dwFadeTime; - } - // Done - return TRUE; -} - -static HRESULT Feedback360DownloadEffect(void *that,CFUUIDRef effectType,FFEffectDownloadID *downloadID,FFEFFECT *effect,FFEffectParameterFlag flags) -{ - ForceParams params; - Xbox360ForceFeedback *this=FFThis(that); - - if(!Feedback360SupportedEffect(effectType)) return FFERR_UNSUPPORTED; - if(!(effect->dwFlags&FFEFF_SPHERICAL)) return FFERR_UNSUPPORTED; - if(effect->dwTriggerButton!=FFEB_NOTRIGGER) return FFERR_UNSUPPORTED; - if(!Feedback360ConvertEffect(effect,¶ms)) return FFERR_UNSUPPORTED; - if(Emulate_IsPaused(&this->emulator)) return FFERR_DEVICEPAUSED; - if(flags&FFEP_NODOWNLOAD) return FF_OK; - if((*downloadID)==0) { - *downloadID=Emulate_CreateEffect(&this->emulator,¶ms); - if((*downloadID)==0) return FFERR_DEVICEFULL; - } else { - if(!Emulate_IsValidEffect(&this->emulator,*downloadID)) return FFERR_INVALIDDOWNLOADID; - if(!Emulate_ChangeEffect(&this->emulator,*downloadID,¶ms)) return FFERR_EFFECTTYPEMISMATCH; - } - if(flags&FFEP_START) { - // Restart - } - return FF_OK; -} - -static HRESULT Feedback360Escape(void *that,FFEffectDownloadID downloadID,FFEFFESCAPE *escape) -{ - Xbox360ForceFeedback *this=FFThis(that); - - if(this==NULL) return FFERR_INVALIDPARAM; - if(downloadID!=0) return FFERR_UNSUPPORTED; - if(escape->dwSizecbOutBuffer=0; - switch(escape->dwCommand) { - case 0x00: // Control motors - if(escape->cbInBuffer!=1) return FFERR_INVALIDPARAM; - this->manual=((unsigned char*)escape->lpvInBuffer)[0]!=0x00; - break; - case 0x01: // Set motors - if(escape->cbInBuffer!=2) return FFERR_INVALIDPARAM; - if(this->manual) { - unsigned char *data=escape->lpvInBuffer; - unsigned char buf[]={0x00,0x04,data[0],data[1]}; - Device_Send(&this->device,buf,sizeof(buf)); - } - break; - case 0x02: // Set LED - if(escape->cbInBuffer!=1) return FFERR_INVALIDPARAM; - { - unsigned char *data=escape->lpvInBuffer; - unsigned char buf[]={0x01,0x03,data[0]}; - Device_Send(&this->device,buf,sizeof(buf)); - } - break; - case 0x03: // Power off - { - unsigned char buf[] = {0x02, 0x02}; - Device_Send(&this->device, buf, sizeof(buf)); - } - break; - default: - fprintf(stderr, "Xbox360Controller FF plugin: Unknown escape (%i)\n", (int)escape->dwCommand); - return FFERR_UNSUPPORTED; - } - return FF_OK; -} - -static HRESULT Feedback360GetEffectStatus(void *that,FFEffectDownloadID downloadID,FFEffectStatusFlag *statusCode) -{ - Xbox360ForceFeedback *this=FFThis(that); - - if(!Emulate_IsValidEffect(&this->emulator,downloadID)) return FFERR_INVALIDDOWNLOADID; - *statusCode=Emulate_IsPlaying(&this->emulator,downloadID)?FFEGES_PLAYING:FFEGES_NOTPLAYING; - return FF_OK; -} - -static HRESULT Feedback360GetForceFeedbackCapabilities(void *this,FFCAPABILITIES *capabilities) -{ - capabilities->ffSpecVer.majorRev=kFFPlugInAPIMajorRev; - capabilities->ffSpecVer.minorAndBugRev=kFFPlugInAPIMinorAndBugRev; - capabilities->ffSpecVer.stage=kFFPlugInAPIStage; - capabilities->ffSpecVer.nonRelRev=kFFPlugInAPINonRelRev; - capabilities->supportedEffects=FFCAP_ET_SQUARE|FFCAP_ET_SINE|FFCAP_ET_TRIANGLE|FFCAP_ET_SAWTOOTHUP|FFCAP_ET_SAWTOOTHDOWN; - capabilities->emulatedEffects=0; - capabilities->subType=FFCAP_ST_VIBRATION; - capabilities->numFfAxes=1; - capabilities->ffAxes[0]=FFJOFS_X; - capabilities->storageCapacity=256; - capabilities->playbackCapacity=1; - capabilities->driverVer.majorRev=FeedbackDriverVersionMajor; - capabilities->driverVer.minorAndBugRev=FeedbackDriverVersionMinor; - capabilities->driverVer.stage=FeedbackDriverVersionStage; - capabilities->driverVer.nonRelRev=FeedbackDriverVersionNonRelRev; - capabilities->firmwareVer.majorRev=1; - capabilities->firmwareVer.minorAndBugRev=0; - capabilities->firmwareVer.stage=developStage; - capabilities->firmwareVer.nonRelRev=0; - capabilities->hardwareVer.majorRev=1; - capabilities->hardwareVer.minorAndBugRev=0; - capabilities->hardwareVer.stage=developStage; - capabilities->hardwareVer.nonRelRev=0; - return S_OK; -} - -static HRESULT Feedback360GetForceFeedbackState(void *that,ForceFeedbackDeviceState *deviceState) -{ - Xbox360ForceFeedback *this=FFThis(that); - - if(deviceState->dwSizedwSize=sizeof(ForceFeedbackDeviceState); - deviceState->dwState - = Emulate_IsEmpty(&this->emulator)?FFGFFS_EMPTY:0 - | Emulate_IsStopped(&this->emulator)?FFGFFS_STOPPED:0 - | Emulate_IsPaused(&this->emulator)?FFGFFS_PAUSED:0 - | Emulate_IsEnabled(&this->emulator)?FFGFFS_ACTUATORSON:FFGFFS_ACTUATORSOFF; - deviceState->dwLoad=(Emulate_Effects_Used(&this->emulator)*100)/Emulate_Effects_Total(&this->emulator); - return S_OK; -} - -static HRESULT Feedback360SendForceFeedbackCommand(void *that,FFCommandFlag state) -{ - Xbox360ForceFeedback *this=FFThis(that); - - switch(state) { - case FFSFFC_RESET: - Emulate_Reset(&this->emulator); - return S_OK; - case FFSFFC_STOPALL: - Emulate_Stop(&this->emulator,0); // 0 == all effects - return S_OK; - case FFSFFC_PAUSE: - case FFSFFC_CONTINUE: - Emulate_SetPaused(&this->emulator,state==FFSFFC_PAUSE); - return S_OK; - case FFSFFC_SETACTUATORSON: - case FFSFFC_SETACTUATORSOFF: - Emulate_SetEnable(&this->emulator,state==FFSFFC_SETACTUATORSON); - return S_OK; - default: - return FFERR_UNSUPPORTED; - } -} - -static HRESULT Feedback360SetProperty(void *that,FFProperty property,void *value) -{ - Xbox360ForceFeedback *this=FFThis(that); - - switch(property) { - case FFPROP_FFGAIN: - { - UInt32 uValue = *((UInt32*)value); - if (uValue > 10000) - return FFERR_INVALIDPARAM; - Emulate_SetGain(&this->emulator, uValue, 10000); - } - return FF_OK; - default: - return FFERR_UNSUPPORTED; - } -} - -static HRESULT Feedback360StartEffect(void *that,FFEffectDownloadID downloadID,FFEffectStartFlag mode,UInt32 iterations) -{ - Xbox360ForceFeedback *this=FFThis(that); - - if(mode&FFES_SOLO) Feedback360SendForceFeedbackCommand(that,FFSFFC_RESET); - Emulate_Start(&this->emulator,downloadID,iterations); - return S_OK; -} - -static HRESULT Feedback360StopEffect(void *that,FFEffectDownloadID downloadID) -{ - Xbox360ForceFeedback *this=FFThis(that); - - if(!Emulate_IsValidEffect(&this->emulator,downloadID)) return FFERR_INVALIDDOWNLOADID; - Emulate_Stop(&this->emulator,downloadID); - return S_OK; -} - -// Function table - -static IOCFPlugInInterface functionMap360_IOCFPlugInInterface={ - // Padding required for COM - NULL, - // IUnknown - Feedback360QueryInterface, - Feedback360AddRef, - Feedback360Release, - // IOCFPlugInInterface - 1,0, // Version - Feedback360Probe, - Feedback360Start, - Feedback360Stop -}; - -static IOForceFeedbackDeviceInterface functionMap360_IOForceFeedbackDeviceInterface={ - // Padding required for COM - NULL, - // IUnknown - Feedback360QueryInterface, - Feedback360AddRef, - Feedback360Release, - // IOForceFeedbackDevice - Feedback360GetVersion, - Feedback360InitializeTerminate, - Feedback360DestroyEffect, - Feedback360DownloadEffect, - Feedback360Escape, - Feedback360GetEffectStatus, - Feedback360GetForceFeedbackCapabilities, - Feedback360GetForceFeedbackState, - Feedback360SendForceFeedbackCommand, - Feedback360SetProperty, - Feedback360StartEffect, - Feedback360StopEffect -}; - -// Constructor and destructor - -static IOCFPlugInInterface** alloc360Feedback(CFUUIDRef uuid) -{ - Xbox360ForceFeedback *item; - - item=(Xbox360ForceFeedback*)malloc(sizeof(Xbox360ForceFeedback)); - item->iIOCFPlugInInterface.pseudoVTable=(IUnknownVTbl*)&functionMap360_IOCFPlugInInterface; - item->iIOCFPlugInInterface.obj=item; - item->iIOForceFeedbackDeviceInterface.pseudoVTable=(IUnknownVTbl*)&functionMap360_IOForceFeedbackDeviceInterface; - item->iIOForceFeedbackDeviceInterface.obj=item; - item->factoryID=CFRetain(uuid); - CFPlugInAddInstanceForFactory(uuid); - item->refCount=1; - return (IOCFPlugInInterface**)&item->iIOCFPlugInInterface.pseudoVTable; -} - -static void dealloc360Feedback(Xbox360ForceFeedback *this) -{ - CFUUIDRef uuid; - - uuid=this->factoryID; - free(this); - if(uuid) { - CFPlugInRemoveInstanceForFactory(uuid); - CFRelease(uuid); - } -} - -// External factory function - -void* Control360Factory(CFAllocatorRef allocator,CFUUIDRef uuid) -{ - if(CFEqual(uuid,kIOForceFeedbackLibTypeID)) return (void*)alloc360Feedback(uuid); - else return NULL; -} diff --git a/Feedback360/main.h b/Feedback360/main.h deleted file mode 100644 index 7da0708..0000000 --- a/Feedback360/main.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - MICE Xbox 360 Controller driver for Mac OS X - Copyright (C) 2006-2013 Colin Munro - - main.h - defines the structure used for the plugin COM object - - This file is part of Xbox360Controller. - - Xbox360Controller is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Xbox360Controller is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Foobar; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ -#include -#include -#include "emulator.h" -#include "devlink.h" - -struct _Xbox360ForceFeedback; - -typedef struct _Xbox360InterfaceMap { - IUnknownVTbl *pseudoVTable; - struct _Xbox360ForceFeedback *obj; -} Xbox360InterfaceMap; - -typedef struct _Xbox360ForceFeedback { - Xbox360InterfaceMap iIOCFPlugInInterface; - Xbox360InterfaceMap iIOForceFeedbackDeviceInterface; - CFUUIDRef factoryID; - UInt32 refCount; - ForceEmulator emulator; - DeviceLink device; - bool manual; -} Xbox360ForceFeedback; - -#define FFThis(interface) (((interface)==NULL)?NULL:(((Xbox360InterfaceMap*)(interface))->obj)) - -#define FeedbackDriverVersionMajor 1 -#define FeedbackDriverVersionMinor 0 -#define FeedbackDriverVersionStage developStage -#define FeedbackDriverVersionNonRelRev 0 - -// B8ED278F-EC8A-4E8E-B4CF-13E2A9D68E83 -#define FeedbackDriverUuid CFUUIDGetConstantUUIDWithBytes(NULL, \ - 0xB8, 0xED, 0x27, 0x8F, 0xEC, 0x8A, 0x4E, 0x8E, \ - 0xB4, 0xCF, 0x13, 0xE2, 0xA9, 0xD6, 0x8E, 0x83) - -// Factory function -void* Control360Factory(CFAllocatorRef allocator,CFUUIDRef uuid); diff --git a/Feedback360/testhaptic.c b/Feedback360/testhaptic.c new file mode 100644 index 0000000..44b1541 --- /dev/null +++ b/Feedback360/testhaptic.c @@ -0,0 +1,374 @@ +/* + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +/* +Copyright (c) 2008, Edgar Simo Serra +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the Simple Directmedia Layer (SDL) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* + * includes + */ +#include +#include /* strstr */ +#include /* isdigit */ + +#include "SDL2/SDL.h" + +#ifndef SDL_HAPTIC_DISABLED + +#include "SDL2/SDL_haptic.h" + +static SDL_Haptic *haptic; + + +/* + * prototypes + */ +static void abort_execution(void); +static void HapticPrintSupported(SDL_Haptic * haptic); + + +/** + * @brief The entry point of this force feedback demo. + * @param[in] argc Number of arguments. + * @param[in] argv Array of argc arguments. + */ +int +main(int argc, char **argv) +{ + int i; + char *name; + int index; + SDL_HapticEffect efx[5]; + int id[5]; + int nefx; + unsigned int supported; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + name = NULL; + index = -1; + if (argc > 1) { + name = argv[1]; + if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) { + SDL_Log("USAGE: %s [device]\n" + "If device is a two-digit number it'll use it as an index, otherwise\n" + "it'll use it as if it were part of the device's name.\n", + argv[0]); + return 0; + } + + i = (int)strlen(name); + if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) { + index = atoi(name); + name = NULL; + } + } + + /* Initialize the force feedbackness */ + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK | + SDL_INIT_HAPTIC); + SDL_Log("%d Haptic devices detected.\n", SDL_NumHaptics()); + if (SDL_NumHaptics() > 0) { + /* We'll just use index or the first force feedback device found */ + if (name == NULL) { + i = (index != -1) ? index : 0; + } + /* Try to find matching device */ + else { + for (i = 0; i < SDL_NumHaptics(); i++) { + if (strstr(SDL_HapticName(i), name) != NULL) + break; + } + + if (i >= SDL_NumHaptics()) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", + name); + return 1; + } + } + + haptic = SDL_HapticOpen(i); + if (haptic == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", + SDL_GetError()); + return 1; + } + SDL_Log("Device: %s\n", SDL_HapticName(i)); + HapticPrintSupported(haptic); + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); + return 1; + } + + /* We only want force feedback errors. */ + SDL_ClearError(); + + /* Create effects. */ + memset(&efx, 0, sizeof(efx)); + nefx = 0; + supported = SDL_HapticQuery(haptic); + + SDL_Log("\nUploading effects\n"); +#if 0 + /* Left motor */ + if(supported & SDL_HAPTIC_LEFTRIGHT) { + SDL_Log(" effect %d: Left Motor\n", nefx); + efx[nefx].type = SDL_HAPTIC_LEFTRIGHT; + efx[nefx].periodic.magnitude = 0x4000; + efx[nefx].periodic.length = 5000; + efx[nefx].leftright.large_magnitude = 1000; + efx[nefx].leftright.small_magnitude = 0; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + + /* Right motor */ + if(supported & SDL_HAPTIC_LEFTRIGHT) { + SDL_Log(" effect %d: Left Motor\n", nefx); + efx[nefx].type = SDL_HAPTIC_LEFTRIGHT; + efx[nefx].periodic.magnitude = 0x4000; + efx[nefx].periodic.length = 5000; + efx[nefx].leftright.large_magnitude = 0; + efx[nefx].leftright.small_magnitude = 1000; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + + /* First we'll try a SINE effect. */ + if (supported & SDL_HAPTIC_SINE) { + SDL_Log(" effect %d: Sine Wave\n", nefx); + efx[nefx].type = SDL_HAPTIC_SINE; + efx[nefx].periodic.period = 1000; + efx[nefx].periodic.magnitude = 32767; + efx[nefx].periodic.length = 5000; + //efx[nefx].periodic.attack_length = 1000; + //efx[nefx].periodic.fade_length = 1000; + efx[nefx].periodic.phase = 0; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + /* Now we'll try a SAWTOOTHUP */ + if (supported & SDL_HAPTIC_SAWTOOTHUP) { + SDL_Log(" effect %d: Sawtooth Up\n", nefx); + efx[nefx].type = SDL_HAPTIC_SAWTOOTHUP; + efx[nefx].periodic.period = 500; + efx[nefx].periodic.magnitude = 0x5000; + efx[nefx].periodic.length = 5000; + efx[nefx].periodic.attack_length = 1000; + efx[nefx].periodic.fade_length = 1000; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + /* Now the classical constant effect. */ + if (supported & SDL_HAPTIC_CONSTANT) { + SDL_Log(" effect %d: Constant Force\n", nefx); + efx[nefx].type = SDL_HAPTIC_CONSTANT; + efx[nefx].constant.direction.type = SDL_HAPTIC_POLAR; + efx[nefx].constant.direction.dir[0] = 20000; /* Force comes from the south-west. */ + efx[nefx].constant.length = 5000; + efx[nefx].constant.level = 0x6000; + efx[nefx].constant.attack_length = 1000; + efx[nefx].constant.fade_length = 1000; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + /* The cute spring effect. */ + if (supported & SDL_HAPTIC_SPRING) { + SDL_Log(" effect %d: Condition Spring\n", nefx); + efx[nefx].type = SDL_HAPTIC_SPRING; + efx[nefx].condition.length = 5000; + for (i = 0; i < SDL_HapticNumAxes(haptic); i++) { + efx[nefx].condition.right_sat[i] = 0x7FFF; + efx[nefx].condition.left_sat[i] = 0x7FFF; + efx[nefx].condition.right_coeff[i] = 0x2000; + efx[nefx].condition.left_coeff[i] = 0x2000; + efx[nefx].condition.center[i] = 0x1000; /* Displace the center for it to move. */ + } + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + /* The pretty awesome inertia effect. */ + if (supported & SDL_HAPTIC_INERTIA) { + SDL_Log(" effect %d: Condition Inertia\n", nefx); + efx[nefx].type = SDL_HAPTIC_SPRING; + efx[nefx].condition.length = 5000; + for (i = 0; i < SDL_HapticNumAxes(haptic); i++) { + efx[nefx].condition.right_sat[i] = 0x7FFF; + efx[nefx].condition.left_sat[i] = 0x7FFF; + efx[nefx].condition.right_coeff[i] = 0x2000; + efx[nefx].condition.left_coeff[i] = 0x2000; + } + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + + /* Finally we'll try a left/right effect. */ + if (supported & SDL_HAPTIC_LEFTRIGHT) { + SDL_Log(" effect %d: Left/Right\n", nefx); + efx[nefx].type = SDL_HAPTIC_LEFTRIGHT; + efx[nefx].leftright.length = 5000; + efx[nefx].leftright.large_magnitude = 0x3000; + efx[nefx].leftright.small_magnitude = 0xFFFF; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } +#endif + + /* Finally we'll try a custom effect. */ + if (supported & SDL_HAPTIC_CUSTOM) { + Uint16 data[] = {0, 32767, 0, 32767/2, 0, 32767/4, 32767, 0, 32767/2, 0, 32767/4, 0}; + SDL_Log(" effect %d: Custom\n", nefx); + efx[nefx].type = SDL_HAPTIC_CUSTOM; + efx[nefx].custom.length = 5000; + efx[nefx].custom.channels = 2; + efx[nefx].custom.samples = 12; + efx[nefx].custom.period = 100; + efx[nefx].custom.data = data; + id[nefx] = SDL_HapticNewEffect(haptic, &efx[nefx]); + if (id[nefx] < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "UPLOADING EFFECT ERROR: %s\n", SDL_GetError()); + abort_execution(); + } + nefx++; + } + + SDL_Log + ("\nNow playing effects for 5 seconds each with 1 second delay between\n"); + for (i = 0; i < nefx; i++) { + SDL_Log(" Playing effect %d\n", i); + SDL_HapticRunEffect(haptic, id[i], 1); + SDL_Delay(6000); /* Effects only have length 5000 */ + } + + /* Quit */ + if (haptic != NULL) + SDL_HapticClose(haptic); + SDL_Quit(); + + return 0; +} + + +/* + * Cleans up a bit. + */ +static void +abort_execution(void) +{ + SDL_Log("\nAborting program execution.\n"); + + SDL_HapticClose(haptic); + SDL_Quit(); + + exit(1); +} + + +/* + * Displays information about the haptic device. + */ +static void +HapticPrintSupported(SDL_Haptic * haptic) +{ + unsigned int supported; + + supported = SDL_HapticQuery(haptic); + SDL_Log(" Supported effects [%d effects, %d playing]:\n", + SDL_HapticNumEffects(haptic), SDL_HapticNumEffectsPlaying(haptic)); + if (supported & SDL_HAPTIC_CONSTANT) + SDL_Log(" constant\n"); + if (supported & SDL_HAPTIC_SINE) + SDL_Log(" sine\n"); + /* !!! FIXME: put this back when we have more bits in 2.1 */ + /* if (supported & SDL_HAPTIC_SQUARE) + SDL_Log(" square\n"); */ + if (supported & SDL_HAPTIC_TRIANGLE) + SDL_Log(" triangle\n"); + if (supported & SDL_HAPTIC_SAWTOOTHUP) + SDL_Log(" sawtoothup\n"); + if (supported & SDL_HAPTIC_SAWTOOTHDOWN) + SDL_Log(" sawtoothdown\n"); + if (supported & SDL_HAPTIC_RAMP) + SDL_Log(" ramp\n"); + if (supported & SDL_HAPTIC_FRICTION) + SDL_Log(" friction\n"); + if (supported & SDL_HAPTIC_SPRING) + SDL_Log(" spring\n"); + if (supported & SDL_HAPTIC_DAMPER) + SDL_Log(" damper\n"); + if (supported & SDL_HAPTIC_INERTIA) + SDL_Log(" inertia\n"); + if (supported & SDL_HAPTIC_CUSTOM) + SDL_Log(" custom\n"); + if (supported & SDL_HAPTIC_LEFTRIGHT) + SDL_Log(" left/right\n"); + SDL_Log(" Supported capabilities:\n"); + if (supported & SDL_HAPTIC_GAIN) + SDL_Log(" gain\n"); + if (supported & SDL_HAPTIC_AUTOCENTER) + SDL_Log(" autocenter\n"); + if (supported & SDL_HAPTIC_STATUS) + SDL_Log(" status\n"); +} + +#else + +int +main(int argc, char *argv[]) +{ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Haptic support.\n"); + exit(1); +} + +#endif diff --git a/Feedback360/testrumble.c b/Feedback360/testrumble.c new file mode 100644 index 0000000..12f4ffb --- /dev/null +++ b/Feedback360/testrumble.c @@ -0,0 +1,154 @@ +/* + Copyright (C) 1997-2013 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. + */ +/* + Copyright (c) 2011, Edgar Simo Serra + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + * Neither the name of the Simple Directmedia Layer (SDL) nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * includes + */ +#include +#include /* strstr */ +#include /* isdigit */ + +#include + +#ifndef SDL_HAPTIC_DISABLED + +#include + +static SDL_Haptic *haptic; + + +/** + * @brief The entry point of this force feedback demo. + * @param[in] argc Number of arguments. + * @param[in] argv Array of argc arguments. + */ +int +main(int argc, char **argv) +{ + int i; + char *name; + int index; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + name = NULL; + index = -1; + if (argc > 1) { + name = argv[1]; + if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) { + SDL_Log("USAGE: %s [device]\n" + "If device is a two-digit number it'll use it as an index, otherwise\n" + "it'll use it as if it were part of the device's name.\n", + argv[0]); + return 0; + } + + i = strlen(name); + if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) { + index = atoi(name); + name = NULL; + } + } + + /* Initialize the force feedbackness */ + SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_JOYSTICK | + SDL_INIT_HAPTIC); + SDL_Log("%d Haptic devices detected.\n", SDL_NumHaptics()); + if (SDL_NumHaptics() > 0) { + /* We'll just use index or the first force feedback device found */ + if (name == NULL) { + i = (index != -1) ? index : 0; + } + /* Try to find matching device */ + else { + for (i = 0; i < SDL_NumHaptics(); i++) { + if (strstr(SDL_HapticName(i), name) != NULL) + break; + } + + if (i >= SDL_NumHaptics()) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to find device matching '%s', aborting.\n", + name); + return 1; + } + } + + haptic = SDL_HapticOpen(i); + if (haptic == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", + SDL_GetError()); + return 1; + } + SDL_Log("Device: %s\n", SDL_HapticName(i)); + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Haptic devices found!\n"); + return 1; + } + + /* We only want force feedback errors. */ + SDL_ClearError(); + + if (SDL_HapticRumbleSupported(haptic) == SDL_FALSE) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Rumble not supported!\n"); + return 1; + } + if (SDL_HapticRumbleInit(haptic) != 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to initialize rumble: %s\n", SDL_GetError()); + return 1; + } + SDL_Log("Playing 2 second rumble at 0.5 magnitude.\n"); + if (SDL_HapticRumblePlay(haptic, 1.0, 5000) != 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError() ); + return 1; + } + SDL_Delay(2000); + SDL_Log("Stopping rumble.\n"); + SDL_HapticRumbleStop(haptic); + SDL_Delay(2000); + SDL_Log("Playing 2 second rumble at 0.3 magnitude.\n"); + if (SDL_HapticRumblePlay(haptic, 0.3f, 5000) != 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to play rumble: %s\n", SDL_GetError() ); + return 1; + } + SDL_Delay(2000); + + /* Quit */ + if (haptic != NULL) + SDL_HapticClose(haptic); + SDL_Quit(); + + return 0; +} + +#else + +int +main(int argc, char *argv[]) +{ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL compiled without Haptic support.\n"); + exit(1); +} + +#endif diff --git a/Feedback360/version.plist b/Feedback360/version.plist deleted file mode 100644 index 53bf3a3..0000000 --- a/Feedback360/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 12 - CFBundleVersion - 1.0 - ProductBuildVersion - 7K571 - ProjectName - DevToolsWizardTemplates - SourceVersion - 3870000 - - diff --git a/Install360Controller/Install360Controller.pkgproj b/Install360Controller/Install360Controller.pkgproj old mode 100755 new mode 100644 index be4569f..5cf658b --- a/Install360Controller/Install360Controller.pkgproj +++ b/Install360Controller/Install360Controller.pkgproj @@ -57,67 +57,17 @@ CHILDREN - - - CHILDREN - - GID - 80 - PATH - ../360Daemon/build/Release/360Daemon - PATH_TYPE - 1 - PERMISSIONS - 493 - TYPE - 3 - UID - 0 - - - CHILDREN - - - CHILDREN - - GID - 80 - PATH - ../360Daemon/Alert.tif - PATH_TYPE - 1 - PERMISSIONS - 420 - TYPE - 3 - UID - 0 - - - GID - 80 - PATH - Resources - PATH_TYPE - 0 - PERMISSIONS - 493 - TYPE - 2 - UID - 0 - - + GID 80 PATH - 360Daemon + ../build/Release/360Daemon.app PATH_TYPE - 0 + 1 PERMISSIONS 493 TYPE - 2 + 3 UID 0 @@ -165,6 +115,71 @@ UID 0 + + CHILDREN + + + CHILDREN + + GID + 0 + PATH + ../build/Release/360Controller.kext + PATH_TYPE + 1 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + ../build/Release/Wireless360Controller.kext + PATH_TYPE + 1 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + CHILDREN + + GID + 0 + PATH + ../build/Release/WirelessGamingReceiver.kext + PATH_TYPE + 1 + PERMISSIONS + 493 + TYPE + 3 + UID + 0 + + + GID + 0 + PATH + Extensions + PATH_TYPE + 0 + PERMISSIONS + 493 + TYPE + 2 + UID + 0 + CHILDREN @@ -287,7 +302,7 @@ GID 0 PATH - ../Pref360Control/build/Deployment/Pref360Control.prefPane + ../build/Release/Pref360Control.prefPane PATH_TYPE 1 PERMISSIONS @@ -477,58 +492,7 @@ CHILDREN - - - BUNDLE_CAN_DOWNGRADE - - CHILDREN - - GID - 0 - PATH - ../360Controller/build/Deployment/360Controller.kext - PATH_TYPE - 1 - PERMISSIONS - 493 - TYPE - 3 - UID - 0 - - - CHILDREN - - GID - 0 - PATH - ../Wireless360Controller/build/Release/Wireless360Controller.kext - PATH_TYPE - 1 - PERMISSIONS - 493 - TYPE - 3 - UID - 0 - - - CHILDREN - - GID - 0 - PATH - ../WirelessGamingReceiver/build/Release/WirelessGamingReceiver.kext - PATH_TYPE - 1 - PERMISSIONS - 493 - TYPE - 3 - UID - 0 - - + GID 0 PATH @@ -654,7 +618,7 @@ OVERWRITE_PERMISSIONS VERSION - 0.12 + 0.15 UUID 95C3DB03-4C99-4A29-AEC7-C73B3D9F6A04 @@ -674,7 +638,7 @@ ZW50LVN0eWxlLVR5cGUiIGNvbnRlbnQ9InRleHQvY3NzIj4KPHRp dGxlPjwvdGl0bGU+CjxtZXRhIG5hbWU9IkdlbmVyYXRvciIgY29u dGVudD0iQ29jb2EgSFRNTCBXcml0ZXIiPgo8bWV0YSBuYW1lPSJD - b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjExODcuMzQiPgo8c3R5bGUg + b2NvYVZlcnNpb24iIGNvbnRlbnQ9IjEyNjUuMjEiPgo8c3R5bGUg dHlwZT0idGV4dC9jc3MiPgo8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5 Pgo8L2JvZHk+CjwvaHRtbD4K @@ -719,6 +683,8 @@ INSTALLATION TYPE 0 + MODE + 1 INSTALLATION_STEPS @@ -827,7 +793,7 @@ VALUE PATH - ../Readme.rtf + Text/Readme.rtf PATH_TYPE 1 @@ -855,7 +821,31 @@ PROJECT_REQUIREMENTS LIST - + + + BEHAVIOR + 2 + DICTIONARY + + IC_REQUIREMENT_OS_DISK_TYPE + 1 + IC_REQUIREMENT_OS_DISTRIBUTION_TYPE + 0 + IC_REQUIREMENT_OS_MINIMUM_VERSION + 100800 + + IC_REQUIREMENT_CHECK_TYPE + 0 + IDENTIFIER + fr.whitebox.Packages.requirement.os + MESSAGE + + NAME + Operating System + STATE + + + POSTINSTALL_PATH PREINSTALL_PATH @@ -881,9 +871,9 @@ CERTIFICATE NAME - Developer ID Installer: Colin Munro + Developer ID Application: Rodrigo Rocha (CDMF3S9CTN) PATH - /Users/colin/Library/Keychains/login.keychain + /Users/Rodrigo/Library/Keychains/login.keychain EXCLUDED_FILES diff --git a/Install360Controller/Scripts/finish.sh b/Install360Controller/Scripts/finish.sh index 6f058a8..d172e1e 100644 --- a/Install360Controller/Scripts/finish.sh +++ b/Install360Controller/Scripts/finish.sh @@ -1,5 +1,10 @@ #!/bin/sh +#This is to fix a bug in Yosemite. +/bin/ln -s /Library/Extensions/360Controller.kext /System/Library/Extensions/ + /usr/bin/touch /System/Library/Extensions +/usr/bin/touch /Library/Extensions +/bin/launchctl load -w /Library/LaunchDaemons/com.mice.360Daemon.plist exit 0 diff --git a/Install360Controller/Scripts/upgrade.sh b/Install360Controller/Scripts/upgrade.sh index c028326..da266b5 100644 --- a/Install360Controller/Scripts/upgrade.sh +++ b/Install360Controller/Scripts/upgrade.sh @@ -2,19 +2,28 @@ # Clear out daemon +# Startup Items is deprecated, should this be removed? +# the daemon is already been launched using launchctl and this folder doent appear to be created anymore. +# https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/StartupItems.html if [ -d /Library/StartupItems/360ControlDaemon ]; then /bin/rm -r /Library/StartupItems/360ControlDaemon fi if [ -f /Library/LaunchDaemons/com.mice.360Daemon.plist ]; then launchctl stop com.mice.360Daemon + launchctl unload /Library/LaunchDaemons/com.mice.360Daemon.plist /bin/rm /Library/LaunchDaemons/com.mice.360Daemon.plist fi +# this folder doesnt appear to be created in recent versions too if [ -d /Library/Application\ Support/MICE/360Daemon ]; then /bin/rm -r /Library/Application\ Support/MICE/360Daemon fi +if [ -d /Library/Application\ Support/MICE/360Daemon.app ]; then + /bin/rm -r /Library/Application\ Support/MICE/360Daemon.app +fi + # Remove preference pane if [ -d /Library/PreferencePanes/Pref360Control.prefPane ]; then @@ -24,15 +33,35 @@ fi # Remove drivers if [ -d /System/Library/Extensions/360Controller.kext ]; then + kextunload /System/Library/Extensions/360Controller.kext /bin/rm -r /System/Library/Extensions/360Controller.kext fi if [ -d /System/Library/Extensions/Wireless360Controller.kext ]; then + kextunload /System/Library/Extensions/Wireless360Controller.kext /bin/rm -r /System/Library/Extensions/Wireless360Controller.kext fi if [ -d /System/Library/Extensions/WirelessGamingReceiver.kext ]; then + kextunload /System/Library/Extensions/WirelessGamingReceiver.kext /bin/rm -r /System/Library/Extensions/WirelessGamingReceiver.kext fi +# Mavericks and later + +if [ -d /Library/Extensions/360Controller.kext ]; then + kextunload /Library/Extensions/360Controller.kext + /bin/rm -r /Library/Extensions/360Controller.kext +fi + +if [ -d /Library/Extensions/Wireless360Controller.kext ]; then + kextunload /Library/Extensions/Wireless360Controller.kext + /bin/rm -r /Library/Extensions/Wireless360Controller.kext +fi + +if [ -d /Library/Extensions/WirelessGamingReceiver.kext ]; then + kextunload /Library/Extensions/WirelessGamingReceiver.kext + /bin/rm -r /Library/Extensions/WirelessGamingReceiver.kext +fi + exit 0 diff --git a/Install360Controller/Text/Readme.rtf b/Install360Controller/Text/Readme.rtf new file mode 100644 index 0000000..539a562 --- /dev/null +++ b/Install360Controller/Text/Readme.rtf @@ -0,0 +1,75 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;\red0\green0\blue128;\red128\green128\blue128;} +\paperw11905\paperh16837\margl1134\margr567\margb567\margt567\vieww10800\viewh8400\viewkind0 +\deftab720 +\pard\pardeftab720\sb240\sa283 + +\f0\b\fs42 \cf0 XBox 360 Controller Driver\ +\pard\pardeftab720\sb200\sa120 + +\fs36 \cf0 About\ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 This driver supports the Microsoft Xbox 360 controller, including access to rumble motors and LEDs, on the Mac OS X platform. It includes a plugin for the Apple Force Feedback Framework so some games will be able to activate them, along with a Preference Pane with which allows you to test everything is installed correctly. Both wired 360 controllers connected via USB, and wireless 360 controllers connected via the Wireless Gaming Receiver for Windows, are supported.\ +This project is a fork of the {\field{\*\fldinst{HYPERLINK "http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller"}}{\fldrslt \cf2 \ul \ulc0 Xbox360Controller project}} originally created by Colin Munro.\ +\pard\pardeftab720\sb200\sa120 + +\b\fs36 \cf0 Installation\ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 See the {\field{\*\fldinst{HYPERLINK "https://github.com/d235j/360Controller/releases"}}{\fldrslt \cf2 \ul \ulc0 releases page}} for the latest compiled and signed version of the driver. Most users will want to install and run this.\ +If you are interested in installing as a developer please see below.\ +\pard\pardeftab720\sb200\sa120 + +\b\fs36 \cf0 Usage\ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 The driver exposes a standard game pad with a number of standard controls, so any game that supports gaming devices should work. In some cases this may need an update from the manufacturer of the game or a patched version. The Preference Pane uses the standard Mac OS X Frameworks for accessing HID devices and accessing Force Feedback capabilities, so should be a good test that the installation is functional.\ +\pard\pardeftab720\sb200\sa120 + +\b\fs36 \cf0 Developer info\ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 Anything below this probably doesn't affect end users, so you can stop reading now if you just want to use the driver.\ +\pard\pardeftab720\sb140\sa120 + +\b\fs28 \cf0 Building\cf3 \ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 You'll need the full xcode installed via the app store. The command line tools are not enough.\ +From the command line, run: ./build.sh\ +If you'd like to build the .pkg file, there is an installer project for Packages. Download packages at {\field{\*\fldinst{HYPERLINK "http://s.sudre.free.fr/Software/Packages/about.html"}}{\fldrslt \cf2 \ul \ulc0 http://s.sudre.free.fr/Software/Packages/about.html}} and the resulting dmg file will be copied to the build directory.\ +The distribution currently consists of 3 projects - one for the driver (implemented in C++, as an I/O Kit C++ class), one for the force feedback support plugin (implemented in C, as an I/O Kit COM plugin) and one for the Preference Pane (implemented in Objective C as a preference pane plugin). Ideally these 3 targets should be in the same project, but I've not worked on this yet.\ +To build, use the standard Xcode build for Deployment on each of the 3 projects. Build Feedback360 before 360Controller, as the 360Controller project includes a script to copy the Feedback360 bundle to the correct place in the .kext to make it work.\ +To debug the driver, sudo cp -R 360Controller.kext /tmp/ to assign the correct properties - note that the Force Feedback plugin only seems to be found by OSX if the driver is in /System/Library/Extensions so I could only debug it in place.\ +To test the Preference Pane, just double-click the resulting file.\ +\pard\pardeftab720\sb140\sa120 + +\b\fs28 \cf0 Yosemite and signed drivers\ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 Since Yosemite (Mac OS X 10.10) all global kexts are required to be signed. This means if you want to build the drivers and install locally, you need to have a mac developer account.\ +If you'd like to avoid paying apple for the developer account and want to disable the signature checking, execute the following commands inside a terminal:\ +\pard\pardeftab720 + +\fs20 \cf0 sudo nvram boot-args="kext-dev-mode=1"\ +\pard\pardeftab720\sa283 +\cf0 sudo kextcache -m /System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext /System/Library/Extensions\ +\pard\pardeftab720\sa283 + +\fs24 \cf0 Note that this is probably a bad idea unless you understand the implications of running unsigned driver code.\ +\pard\pardeftab720\sb140\sa120 + +\b\fs28 \cf0 Debugging\cf3 \ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 Most of the debugging I did was via printing out text. In 360Controller, you can use IOLog(), and the output will appear in system.log. In Feedback360 normal fprintf(stderr,...), and the output will appear on the console of whatever application is attempting to use Force Feedback. In Pref360Control, NSLog() works as it's an Objective C program, and will output to the console of the Preferences application.\ +\pard\pardeftab720\sb200\sa120 + +\b\fs36 \cf0 Licence\ +\pard\pardeftab720\sa283 + +\b0\fs24 \cf0 Copyright (C) 2006-2013 Colin Munro\ +This driver is licensed under the GNU Public License. A copy of this license is included in the distribution file, please inspect it before using the binary or source.\ +} \ No newline at end of file diff --git a/Install360Controller/Text/Welcome.rtf b/Install360Controller/Text/Welcome.rtf index 5ebcf3d..c1769a4 100644 --- a/Install360Controller/Text/Welcome.rtf +++ b/Install360Controller/Text/Welcome.rtf @@ -1,5 +1,5 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\rtf1\ansi\ansicpg1252\cocoartf1343\cocoasubrtf160 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} {\colortbl;\red255\green255\blue255;} {\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1} {\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2} @@ -11,25 +11,93 @@ {\list\listtemplateid8\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid701\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid8} {\list\listtemplateid9\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid801\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid9} {\list\listtemplateid10\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid901\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid10} -{\list\listtemplateid11\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1001\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid11}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}{\listoverride\listid4\listoverridecount0\ls4}{\listoverride\listid5\listoverridecount0\ls5}{\listoverride\listid6\listoverridecount0\ls6}{\listoverride\listid7\listoverridecount0\ls7}{\listoverride\listid8\listoverridecount0\ls8}{\listoverride\listid9\listoverridecount0\ls9}{\listoverride\listid10\listoverridecount0\ls10}{\listoverride\listid11\listoverridecount0\ls11}} +{\list\listtemplateid11\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1001\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid11} +{\list\listtemplateid12\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid12} +{\list\listtemplateid13\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1201\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid13} +{\list\listtemplateid14\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1301\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid14} +{\list\listtemplateid15\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1401\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid15} +{\list\listtemplateid16\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1501\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid16}} +{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}{\listoverride\listid4\listoverridecount0\ls4}{\listoverride\listid5\listoverridecount0\ls5}{\listoverride\listid6\listoverridecount0\ls6}{\listoverride\listid7\listoverridecount0\ls7}{\listoverride\listid8\listoverridecount0\ls8}{\listoverride\listid9\listoverridecount0\ls9}{\listoverride\listid10\listoverridecount0\ls10}{\listoverride\listid11\listoverridecount0\ls11}{\listoverride\listid12\listoverridecount0\ls12}{\listoverride\listid13\listoverridecount0\ls13}{\listoverride\listid14\listoverridecount0\ls14}{\listoverride\listid15\listoverridecount0\ls15}{\listoverride\listid16\listoverridecount0\ls16}} \paperw12240\paperh15840\margl1440\margr1440\vieww14760\viewh12840\viewkind0 \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \f0\b\fs42 \cf0 XBox 360 Controller Driver\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\b0\fs24 Version 0.12\ +\b0\fs24 \cf0 Version 0.15\ Copyright (C) 2005-2013 Colin Munro\ \ Welcome to the installer for the XBox 360 Controller driver for Mac OS X.\ -\ + +\b \ +Update 0.15: XX/XX/2015\ + +\b0 This update includes:\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls1\ilvl0\cf0 {\listtext \'95 }TODO +\b \ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural +\cf0 \ +Update 0.14: 12/23/2014\ + +\b0 This update includes:\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls2\ilvl0\cf0 {\listtext \'95 }Fixes Force Feedback and the controller lights that were broken on the beta\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls2\ilvl0 +\b \cf0 {\listtext \'95 } +\b0 Bug fixes for Force feedback with < 1 second duration\ +\ls2\ilvl0 +\b {\listtext \'95 } +\b0 Bug fixes for some devices\ +{\listtext \'95 }Fixed the compilation of 32bit code. +\b \ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural +\cf0 \ +Update 0.14 (beta): 10/30/2014\ + +\b0 This update includes:\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls3\ilvl0\cf0 {\listtext \'95 }Cocoa code modernization by C.W. Betts. This includes synthesized getters/setters, KVO/KVC, and migration to ARC.\ +{\listtext \'95 }General code readability improvements\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls3\ilvl0 +\b \cf0 {\listtext \'95 } +\b0 Better handling of feedback effects\ +{\listtext \'95 }Force Feedback is currently broken in this beta, {\field{\*\fldinst{HYPERLINK "https://github.com/d235j/360Controller/issues/22"}}{\fldrslt apparently due to an upstream Apple bug}}\ +\ls3\ilvl0 +\b {\listtext \'95 } +\b0 Updated code signing to be compatible with 10.10 Yosemite\ +\ls3\ilvl0 +\b {\listtext \'95 } +\b0 Package and Kexts Signed by {\field{\*\fldinst{HYPERLINK "https://twitter.com/RodrigoRodrigoR"}}{\fldrslt Rodrigo C. Rocha}} +\b \ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural +\cf0 \ +Update 0.13.1: 10/11/2013\ + +\b0 This update includes:\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls4\ilvl0\cf0 {\listtext \'95 }Fix for kernel panics when Android File Transfer is also installed\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural + +\b \cf0 \ +Update 0.13: 9/29/2013\ + +\b0 \ +This update includes:\ +\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural +\ls5\ilvl0\cf0 {\listtext \'95 }Near-total rewrite of the Feedback component\ +{\listtext \'95 }Bug fixes in the preference pane\ +\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural +\cf0 \ \b Update 0.12: 4/01/2013\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls1\ilvl0\cf0 {\listtext \'95 }Fix that prevents non-ChatPad-compatible controllers from working\ +\ls6\ilvl0\cf0 {\listtext \'95 }Fix that prevents non-ChatPad-compatible controllers from working\ {\listtext \'95 }Improvement to ChatPad support\ {\listtext \'95 }Improvement to wireless support (automatic and manual power-off)\ {\listtext \'95 }Updated Info.plist with many common devices\ @@ -41,7 +109,7 @@ This update includes:\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls2\ilvl0\cf0 {\listtext \'95 }Temporary Lion fix (thanks to "codeman38")\ +\ls7\ilvl0\cf0 {\listtext \'95 }Temporary Lion fix (thanks to "codeman38")\ {\listtext \'95 }Adjustment to the automatic device match function\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \cf0 \ @@ -51,7 +119,7 @@ This update includes:\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls3\ilvl0\cf0 {\listtext \'95 }Various bugfixes\ +\ls8\ilvl0\cf0 {\listtext \'95 }Various bugfixes\ {\listtext \'95 }New product IDs for Wireless Gaming Receiver\ {\listtext \'95 }Automatic device match function, allowing you to select and deselect which controllers you want it to match with\ {\listtext \'95 }Fix the incompatibility with Bioshock introduced with ChatPad support\ @@ -63,7 +131,7 @@ This update includes:\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls4\ilvl0\cf0 {\listtext \'95 }Driver rearchitecture\ +\ls9\ilvl0\cf0 {\listtext \'95 }Driver rearchitecture\ {\listtext \'95 }ChatPad support in wired controller\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural @@ -73,7 +141,7 @@ Update 0.08: 10/09/2009\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls5\ilvl0\cf0 {\listtext \'95 }64-bit support (untested)\ +\ls10\ilvl0\cf0 {\listtext \'95 }64-bit support (untested)\ {\listtext \'95 }Fix for Snow Leopard\ {\listtext \'95 }Minor bugfixes\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural @@ -84,7 +152,7 @@ This update includes:\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls6\ilvl0\cf0 {\listtext \'95 }10.4 bugfix\ +\ls11\ilvl0\cf0 {\listtext \'95 }10.4 bugfix\ {\listtext \'95 }Extra controller IDs\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \cf0 \ @@ -94,7 +162,7 @@ This update includes:\ \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls7\ilvl0\cf0 {\listtext \'95 }Improvements to the wireless support\ +\ls12\ilvl0\cf0 {\listtext \'95 }Improvements to the wireless support\ {\listtext \'95 }Daemon providing persistent settings and LED setting\ {\listtext \'95 }Bugfix to support Halo\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural @@ -105,7 +173,7 @@ This update includes:\ \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls8\ilvl0\cf0 {\listtext \'95 }Improvements to the wireless support\ +\ls13\ilvl0\cf0 {\listtext \'95 }Improvements to the wireless support\ {\listtext \'95 }New increased compatibility with games\ {\listtext \'95 }Support for the Guitar Hero controller\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural @@ -116,7 +184,7 @@ This update includes:\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls9\ilvl0\cf0 {\listtext \'95 }Driver for the Microsoft Wireless Gaming Receiver for Windows\ +\ls14\ilvl0\cf0 {\listtext \'95 }Driver for the Microsoft Wireless Gaming Receiver for Windows\ {\listtext \'95 }Driver for the above to use the Wireless 360 Controller\ {\listtext \'95 }Updates to the Preference Pane to support the Wireless 360 Controller\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural @@ -127,7 +195,7 @@ This update includes:\ \b0 \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls10\ilvl0\cf0 {\listtext \'95 }More 3rd party vendor/product IDs\ +\ls15\ilvl0\cf0 {\listtext \'95 }More 3rd party vendor/product IDs\ \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural \cf0 \ @@ -136,7 +204,7 @@ This update includes:\ \ This update includes:\ \pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls11\ilvl0\cf0 {\listtext \'95 }Universal binaries, for Intel Mac support\ +\ls16\ilvl0\cf0 {\listtext \'95 }Universal binaries, for Intel Mac support\ {\listtext \'95 }Additional 3rd party vendor/product IDs (support for matching on interface instead of IDs still isn't working)\ {\listtext \'95 }Preference Pane now correctly detects devices being connected/disconnected\ {\listtext \'95 }Alternative deadzone mode\ @@ -145,4 +213,8 @@ This update includes:\ \cf0 \ Please visit {\field{\*\fldinst{HYPERLINK "http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver"}}{\fldrslt http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver}} for information on this software. Consider donating or buying via the Amazon associate links to support development of this driver!\ \ + +\b Update: +\b0 Since the version 0.13 you can find new releases of this software here: {\field{\*\fldinst{HYPERLINK "https://github.com/d235j/360Controller/releases/"}}{\fldrslt https://github.com/d235j/360Controller/releases/}} , this is a fork of the driver initially developed by TattieBogle.\ +\ Ensure to read the following Read Me and License sections before installing!} \ No newline at end of file diff --git a/Pref360Control/BindingTableView.h b/Pref360Control/BindingTableView.h new file mode 100644 index 0000000..9d3a5e8 --- /dev/null +++ b/Pref360Control/BindingTableView.h @@ -0,0 +1,19 @@ +// +// BindingTableView.h +// 360 Driver +// +// Created by Drew Mills on 1/30/15. +// + +#import + +@interface BindingTableView : NSObject + +@property NSArray *buttonArr; + ++ (NSTableView *)tableView; + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView; +- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex; + +@end diff --git a/Pref360Control/BindingTableView.m b/Pref360Control/BindingTableView.m new file mode 100644 index 0000000..3800530 --- /dev/null +++ b/Pref360Control/BindingTableView.m @@ -0,0 +1,36 @@ +// +// BindingTableView.m +// 360 Driver +// +// Created by Drew Mills on 1/30/15. +// + +#import "BindingTableView.h" +#import "MyWhole360ControllerMapper.h" + +@implementation BindingTableView + +static NSTableView *tblView; + ++ (NSTableView *)tableView { + return tblView; +} + +- (void)awakeFromNib { + _buttonArr = @[@"Up", @"Down", @"Left", @"Right", @"Start", @"Back", @"LS Click", @"RS Click", @"LB", @"RB", @"Guide", @"A", @"B", @"X", @"Y"]; +} + +- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView { + tblView = tableView; + return [_buttonArr count]; +} + +- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { + if ([[aTableColumn identifier] isEqualToString:@"input"]) { + return [NSNumber numberWithInt:[MyWhole360ControllerMapper mapping][rowIndex]]; + } + else + return _buttonArr[rowIndex]; +} + +@end diff --git a/Pref360Control/DeviceItem.h b/Pref360Control/DeviceItem.h index 4c27482..748f1ee 100644 --- a/Pref360Control/DeviceItem.h +++ b/Pref360Control/DeviceItem.h @@ -21,24 +21,20 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #import -#import -#import -#import -#import -#import +#include +#include +#include +#include +#include -@interface DeviceItem : NSObject { - IOHIDDeviceInterface122 **interface; - FFDeviceObjectReference forceFeedback; - io_service_t deviceHandle; - NSString *deviceName; -} +@interface DeviceItem : NSObject +@property (strong, readonly) NSString *name; +@property (readonly) io_service_t rawDevice; +@property (readonly) FFDeviceObjectReference ffDevice; +@property (readonly) IOHIDDeviceInterface122 **hidDevice; -+ allocateDeviceItemForDevice:(io_service_t)device; ++ (instancetype)allocateDeviceItemForDevice:(io_service_t)device; -- (NSString*)name; -- (IOHIDDeviceInterface122**)hidDevice; -- (FFDeviceObjectReference)ffDevice; -- (io_service_t)rawDevice; +- (instancetype)initWithItemForDevice:(io_service_t)device; @end diff --git a/Pref360Control/DeviceItem.m b/Pref360Control/DeviceItem.m index 2fba7cf..4f38f0a 100644 --- a/Pref360Control/DeviceItem.m +++ b/Pref360Control/DeviceItem.m @@ -30,71 +30,69 @@ if (IORegistryEntryCreateCFProperties(device, &serviceProperties, kCFAllocatorDefault, kNilOptions) != KERN_SUCCESS) return nil; - properties = (NSDictionary*)serviceProperties; - deviceName = [properties objectForKey:(NSString*)CFSTR(kIOHIDProductKey)]; + properties = CFBridgingRelease(serviceProperties); + deviceName = properties[@kIOHIDProductKey]; if (deviceName == nil) - deviceName = [properties objectForKey:@"USB Product Name"]; - [deviceName retain]; - CFRelease(serviceProperties); + deviceName = properties[@"USB Product Name"]; return deviceName; } +@interface DeviceItem () +@property (strong, readwrite) NSString *name; +@property (readwrite) io_service_t rawDevice; +@property (readwrite) FFDeviceObjectReference ffDevice; +@property (readwrite) IOHIDDeviceInterface122 **hidDevice; +@end + @implementation DeviceItem +@synthesize name = deviceName; +@synthesize rawDevice = deviceHandle; +@synthesize ffDevice = forceFeedback; +@synthesize hidDevice = interface; + +- (instancetype)initWithItemForDevice:(io_service_t)device +{ + if (self = [super init]) { + IOReturn ret; + IOCFPlugInInterface **plugInInterface; + SInt32 score=0; + + ret = IOCreatePlugInInterfaceForService(device, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); + if (ret != kIOReturnSuccess) { + return nil; + } + ret = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122), (LPVOID)&interface); + (*plugInInterface)->Release(plugInInterface); + if (ret != kIOReturnSuccess) { + return nil; + } + forceFeedback = 0; + FFCreateDevice(device, &forceFeedback); + self.rawDevice = device; + self.name = GetDeviceName(device); + } + return self; +} -+ allocateDeviceItemForDevice:(io_service_t)device ++ (instancetype)allocateDeviceItemForDevice:(io_service_t)device { - DeviceItem *item; - IOReturn ret; - IOCFPlugInInterface **plugInInterface; - SInt32 score=0; + DeviceItem *item = [[[self class] alloc] initWithItemForDevice:device]; + + if (item) + return item; - item=[[[DeviceItem alloc] init] autorelease]; - if(item==nil) goto fail; - ret=IOCreatePlugInInterfaceForService(device,kIOHIDDeviceUserClientTypeID,kIOCFPlugInInterfaceID,&plugInInterface,&score); - if(ret!=kIOReturnSuccess) goto fail; - ret=(*plugInInterface)->QueryInterface(plugInInterface,CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID122),(LPVOID)&item->interface); - (*plugInInterface)->Release(plugInInterface); - if(ret!=kIOReturnSuccess) goto fail; - item->forceFeedback=0; - FFCreateDevice(device,&item->forceFeedback); - item->deviceHandle=device; - item->deviceName = GetDeviceName(device); - return item; -fail: IOObjectRelease(device); - return NULL; + return nil; } - (void)dealloc { - if(deviceHandle != 0) + if (deviceHandle) IOObjectRelease(deviceHandle); - if(interface != NULL) + if (interface) (*interface)->Release(interface); - if(forceFeedback != 0) + if (forceFeedback) FFReleaseDevice(forceFeedback); - [deviceName release]; - [super dealloc]; -} - -- (NSString*)name -{ - return deviceName; -} - -- (IOHIDDeviceInterface122**)hidDevice -{ - return interface; -} - -- (FFDeviceObjectReference)ffDevice -{ - return forceFeedback; -} - -- (io_service_t)rawDevice -{ - return deviceHandle; } @end diff --git a/Pref360Control/DeviceLister.h b/Pref360Control/DeviceLister.h index 041f802..8eb3283 100644 --- a/Pref360Control/DeviceLister.h +++ b/Pref360Control/DeviceLister.h @@ -24,16 +24,9 @@ @class Pref360ControlPref; -@interface DeviceLister : NSObject { - Pref360ControlPref *owner; - IBOutlet NSWindow *sheet; - IBOutlet NSTableView *list; - - NSMutableDictionary *entries; - NSMutableArray *connected, *enabled; - - BOOL changed; -} +@interface DeviceLister : NSObject +@property (weak) IBOutlet NSWindow *sheet; +@property (weak) IBOutlet NSTableView *list; - (void)showWithOwner:(Pref360ControlPref*)pane; - (IBAction)done:(id)sender; diff --git a/Pref360Control/DeviceLister.m b/Pref360Control/DeviceLister.m index 027d4db..9cb8c89 100644 --- a/Pref360Control/DeviceLister.m +++ b/Pref360Control/DeviceLister.m @@ -20,29 +20,29 @@ along with Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#import +#include #import "DeviceLister.h" #import "Pref360ControlPref.h" #import "ControlPrefs.h" -#define TOOL_FILENAME @"DriverTool" +#define TOOL_FILENAME @"DriverTool" + +#define Three60LocalizedString(key, comment) NSLocalizedStringWithDefaultValue(key, nil, [NSBundle bundleForClass:[self class]], key, comment) // Get some sort of CF type for a field in the IORegistry static id GetDeviceValue(io_service_t device, NSString *key) { - CFTypeRef value; - - value = IORegistryEntrySearchCFProperty(device, kIOServicePlane, (CFStringRef)key, kCFAllocatorDefault, kIORegistryIterateRecursively); - return [((NSObject*)value) autorelease]; + CFTypeRef value = IORegistryEntrySearchCFProperty(device, kIOServicePlane, (__bridge CFStringRef)key, kCFAllocatorDefault, kIORegistryIterateRecursively); + + return CFBridgingRelease(value); } // Make sure a name is as nice as possible for eventually going into the XML for the driver static NSString* SanitiseName(NSString *name) { - NSMutableString *output; - int i; + NSMutableString *output = [[NSMutableString alloc] initWithCapacity:100]; + NSInteger i; - output = [NSMutableString stringWithCapacity:100]; for (i = 0; i < [name length]; i++) { unichar c = [name characterAtIndex:i]; @@ -52,7 +52,7 @@ static id GetDeviceValue(io_service_t device, NSString *key) continue; [output appendFormat:@"%C", c]; } - return output; + return [[NSString alloc] initWithString:output]; } // Get the Device interface for a given IO service @@ -92,7 +92,7 @@ static id GetDeviceValue(io_service_t device, NSString *key) } // List of interfaces we expect on a normal Microsoft controller -const struct { +const struct ControllerInterface { int numEndpoints; UInt8 classNum, subClassNum, protocolNum; } ControllerInterfaces[] = { @@ -106,7 +106,7 @@ static id GetDeviceValue(io_service_t device, NSString *key) // Detect if an IO service object is a Microsoft controller by running through and checking some things static BOOL IsXBox360Controller(io_service_t device) { - IOUSBDeviceInterface **interface; + IOUSBDeviceInterface **interface = GetDeviceInterface(device); IOUSBFindInterfaceRequest iRq; io_iterator_t iterator; io_service_t devInterface; @@ -118,7 +118,6 @@ static BOOL IsXBox360Controller(io_service_t device) BOOL devValid; // Get the interface to the device - interface = GetDeviceInterface(device); if (interface == NULL) return NO; (*interface)->GetDeviceClass(interface, &classNum); @@ -146,15 +145,10 @@ static BOOL IsXBox360Controller(io_service_t device) (*interfaceInterface)->GetNumEndpoints(interfaceInterface, &endpointCount); if (interfaceNum < (sizeof(ControllerInterfaces) / sizeof(ControllerInterfaces[0]))) { - if ( - (ControllerInterfaces[interfaceNum].classNum == classNum) - && - (ControllerInterfaces[interfaceNum].subClassNum == subClassNum) - && - (ControllerInterfaces[interfaceNum].protocolNum == protocolNum) - && - (ControllerInterfaces[interfaceNum].numEndpoints == endpointCount) - ) + if ((ControllerInterfaces[interfaceNum].classNum == classNum) && + (ControllerInterfaces[interfaceNum].subClassNum == subClassNum) && + (ControllerInterfaces[interfaceNum].protocolNum == protocolNum) && + (ControllerInterfaces[interfaceNum].numEndpoints == endpointCount)) { // Found another interface in the right place interfaceCount++; @@ -173,75 +167,43 @@ static BOOL IsXBox360Controller(io_service_t device) return devValid && (interfaceCount >= 3); // Only 3 in case the security descriptor is missing? } +@interface DeviceLister () +@property (getter = isChanged) BOOL changed; +@property (strong) NSMutableDictionary *entries; +@property (weak) Pref360ControlPref *owner; +@end + @implementation DeviceLister +{ + NSMutableArray *connected, *enabled; +} +@synthesize list; +@synthesize sheet; +@synthesize changed; +@synthesize entries; +@synthesize owner; -- init +- (instancetype)init { if (self = [super init]) { - entries = [[NSMutableDictionary dictionaryWithCapacity:10] retain]; - connected = [[NSMutableArray arrayWithCapacity:10] retain]; - enabled = [[NSMutableArray arrayWithCapacity:10] retain]; + self.entries = [[NSMutableDictionary alloc] initWithCapacity:10]; + connected = [[NSMutableArray alloc] initWithCapacity:10]; + enabled = [[NSMutableArray alloc] initWithCapacity:10]; } return self; } -- (void)dealloc -{ - [entries release]; - [connected release]; - [enabled release]; - [super dealloc]; -} - - (NSString*)toolPath { // Find the path of our tool in our bundle - should it be in the driver's bundle? - return [[[owner bundle] resourcePath] stringByAppendingPathComponent:TOOL_FILENAME]; + return [[owner.bundle resourcePath] stringByAppendingPathComponent:TOOL_FILENAME]; } - (OSStatus)writeToolWithAuthorisation:(AuthorizationRef)authorisationRef { - OSStatus result; - NSString *toolPath; - NSMutableArray *parameters; - const char **argv; - int i; - - toolPath = [self toolPath]; - - // Build array of parameters - parameters = [NSMutableArray arrayWithCapacity:10]; - [parameters addObject:@"edit"]; - - for (NSNumber *key in enabled) - { - NSString *name = [entries objectForKey:key]; - NSUInteger keyValue = [key unsignedIntValue]; - UInt16 vendor = (keyValue >> 16) & 0xFFFF; - UInt16 product = keyValue & 0xFFFF; - [parameters addObject:name]; - [parameters addObject:[NSString stringWithFormat:@"%i", vendor]]; - [parameters addObject:[NSString stringWithFormat:@"%i", product]]; - } - - // Convert parameters to a C array - argv = malloc(sizeof(char*) * ([parameters count] + 1)); - i = 0; - for (NSString *item in parameters) - argv[i++] = [item UTF8String]; - argv[i] = NULL; - - // Execute the command - result = AuthorizationExecuteWithPrivileges(authorisationRef, - [toolPath UTF8String], - kAuthorizationFlagDefaults, - (char**)argv, - NULL); - - // Done - free(argv); - return result; + // Pending major re-write, just return noErr + return noErr; } - (NSString*)readTool @@ -253,7 +215,7 @@ - (NSString*)readTool NSArray *lines; // Prepare to run the tool - task = [[[NSTask alloc] init] autorelease]; + task = [[NSTask alloc] init]; [task setLaunchPath:[self toolPath]]; // Hook up the pipe to catch the output @@ -270,12 +232,12 @@ - (NSString*)readTool if ([task terminationStatus] != 0) { data = [[error fileHandleForReading] readDataToEndOfFile]; - return [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } // Read the data back data = [[pipe fileHandleForReading] readDataToEndOfFile]; - response = [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; + response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; // Parse the results lines = [response componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; @@ -284,12 +246,12 @@ - (NSString*)readTool NSArray *values = [line componentsSeparatedByString:@","]; if ([values count] != 3) continue; - NSUInteger vendor = [[values objectAtIndex:1] intValue]; - NSUInteger product = [[values objectAtIndex:2] intValue]; - NSNumber *key = [NSNumber numberWithUnsignedInt:(int)((vendor << 16) | product)]; + unsigned int vendor = [values[1] unsignedIntValue]; + unsigned int product = [values[2] unsignedIntValue]; + NSNumber *key = @((UInt32)((vendor << 16) | product)); [enabled addObject:key]; - if ([entries objectForKey:key] == nil) - [entries setObject:SanitiseName([values objectAtIndex:0]) forKey:key]; + if (entries[key] == nil) + entries[key] = SanitiseName(values[0]); } return nil; @@ -305,8 +267,8 @@ - (NSString*)readKnownDevices keys = [known allKeys]; for (NSNumber *key in keys) { - if ([entries objectForKey:key] == nil) - [entries setObject:[known objectForKey:key] forKey:key]; + if (entries[key] == nil) + entries[key] = known[key]; } return nil; } @@ -314,10 +276,9 @@ - (NSString*)readKnownDevices // Find any matching devices currently plugged in - (NSString*)readIOKit { - io_iterator_t iterator; + io_iterator_t iterator = 0; io_service_t object; - iterator = 0; IOServiceGetMatchingServices([owner masterPort], IOServiceMatching(kIOUSBDeviceClassName), &iterator); if (iterator != 0) { @@ -336,18 +297,17 @@ - (NSString*)readIOKit if ((vendorValue != nil) && (productValue != nil)) { - NSNumber *key; + NSNumber *key = @((UInt32)((vendor << 16) | product)); - key = [NSNumber numberWithUnsignedInt:(vendor << 16) | product]; [connected addObject:key]; - if ([entries objectForKey:key] == nil) + if (entries[key] == nil) { NSString *name = GetDeviceValue(object, @"USB Product Name"); if (name == nil) name = [NSString stringWithFormat:@"Unknown_%.4x_%.4x", vendor, product]; else name = SanitiseName(name); - [entries setObject:name forKey:key]; + entries[key] = name; } } } @@ -360,7 +320,7 @@ - (NSString*)readIOKit - (void)showFailure:(NSString*)message { - NSAlert *alert = [NSAlert alertWithMessageText:nil + NSAlert *alert = [NSAlert alertWithMessageText:@"Error" defaultButton:nil alternateButton:nil otherButton:nil @@ -373,7 +333,6 @@ - (BOOL)loadDevices NSString *error; // Initialise - error = nil; [entries removeAllObjects]; [connected removeAllObjects]; [enabled removeAllObjects]; @@ -396,7 +355,7 @@ - (BOOL)loadDevices // Done SetKnownDevices(entries); [list reloadData]; - changed = NO; + self.changed = NO; return YES; } @@ -413,7 +372,7 @@ - (BOOL)trySave &authorisationRef); if (status != errAuthorizationSuccess) { - [self showFailure:NSLocalizedString(@"Unable to create authorisation request", @"")]; + [self showFailure:Three60LocalizedString(@"Unable to create authorisation request", @"")]; return NO; } @@ -426,14 +385,14 @@ - (BOOL)trySave NULL); if (status != errAuthorizationSuccess) { - [self showFailure:NSLocalizedString(@"Unable to acquire authorisation", @"")]; + [self showFailure:Three60LocalizedString(@"Unable to acquire authorisation", @"")]; goto fail; } status = [self writeToolWithAuthorisation:authorisationRef]; if (status != errAuthorizationSuccess) { - [self showFailure:NSLocalizedString(@"Failed to execute the driver tool", @"")]; + [self showFailure:Three60LocalizedString(@"Failed to execute the driver tool", @"")]; goto fail; } @@ -446,7 +405,7 @@ - (BOOL)trySave - (void)showWithOwner:(Pref360ControlPref*)pane { - owner = pane; + self.owner = pane; if (![self loadDevices]) return; [NSApp beginSheet:sheet @@ -464,8 +423,27 @@ - (IBAction)done:(id)sender [sheet close]; } -// NSTableView data source +- (NSArray*)allEntries +{ + return [[entries allKeys] sortedArrayWithOptions:NSSortConcurrent usingComparator:^NSComparisonResult(id obj1, id obj2) { + NSNumber *str1 = obj1; + NSNumber *str2 = obj2; + UInt32 num1 = str1.unsignedIntValue; + UInt32 num2 = str2.unsignedIntValue; + + NSComparisonResult retval; + if (num1 > num2) { + retval = NSOrderedAscending; + } else if (num1 < num2) { + retval = NSOrderedDescending; + } else { + retval = NSOrderedSame; + } + return retval; + }]; +} +// NSTableView data source - (NSInteger)numberOfRowsInTableView:(NSTableView*)tableView { return [entries count]; @@ -474,10 +452,10 @@ - (NSInteger)numberOfRowsInTableView:(NSTableView*)tableView - (id)tableView:(NSTableView*)aTableView objectValueForTableColumn:(NSTableColumn*)aTableColumn row:(NSInteger)rowIndex { NSString *identifier = [aTableColumn identifier]; - NSString *key = [[entries allKeys] objectAtIndex:rowIndex]; + NSString *key = [self allEntries][rowIndex]; if ([identifier compare:@"enable"] == NSOrderedSame) { - return [NSNumber numberWithBool:[enabled containsObject:key]]; + return @([enabled containsObject:key]); } if ([identifier compare:@"name"] == NSOrderedSame) { @@ -487,8 +465,8 @@ - (id)tableView:(NSTableView*)aTableView objectValueForTableColumn:(NSTableColum colour = [NSColor blueColor]; else colour = [NSColor blackColor]; - return [[[NSAttributedString alloc] initWithString:[entries objectForKey:key] - attributes:[NSDictionary dictionaryWithObject:colour forKey:NSForegroundColorAttributeName]] autorelease]; + return [[NSAttributedString alloc] initWithString:entries[key] + attributes:@{NSForegroundColorAttributeName: colour}]; } return nil; } @@ -497,14 +475,14 @@ - (void)tableView:(NSTableView*)aTableView setObjectValue:(id)anObject forTableC { if ([(NSString*)[aTableColumn identifier] compare:@"enable"] == NSOrderedSame) { - NSString *key = [[entries allKeys] objectAtIndex:rowIndex]; + NSString *key = [self allEntries][rowIndex]; BOOL contains = [enabled containsObject:key]; if ([(NSNumber*)anObject boolValue]) { if (!contains) { [enabled addObject:key]; - changed = YES; + self.changed = YES; } } else @@ -512,10 +490,9 @@ - (void)tableView:(NSTableView*)aTableView setObjectValue:(id)anObject forTableC if (contains) { [enabled removeObject:key]; - changed = YES; + self.changed = YES; } } - } } diff --git a/Pref360Control/English.lproj/InfoPlist.strings b/Pref360Control/English.lproj/InfoPlist.strings deleted file mode 100644 index 6542423..0000000 Binary files a/Pref360Control/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/Pref360Control/English.lproj/Pref360ControlPref.nib/designable.nib b/Pref360Control/English.lproj/Pref360ControlPref.nib/designable.nib deleted file mode 100644 index 16ccac1..0000000 --- a/Pref360Control/English.lproj/Pref360ControlPref.nib/designable.nib +++ /dev/null @@ -1,2148 +0,0 @@ - - - - 1050 - 12C60 - 2844 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 2844 - - - NSBox - NSButton - NSButtonCell - NSCustomObject - NSCustomView - NSImageCell - NSImageView - NSMenu - NSMenuItem - NSPopUpButton - NSPopUpButtonCell - NSProgressIndicator - NSScrollView - NSScroller - NSSlider - NSSliderCell - NSTableColumn - NSTableView - NSTextField - NSTextFieldCell - NSView - NSWindowTemplate - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - Pref360ControlPref - - - FirstResponder - - - NSApplication - - - 7 - 2 - {{240, 597}, {595, 304}} - 1081606144 - << do not localize >> - NSWindow - - View - - - {595, 10} - - - 256 - - - - 256 - {{107, 260}, {471, 26}} - - - - YES - - -2076180416 - 2048 - - LucidaGrande - 13 - 1044 - - - 109199360 - 1 - - LucidaGrande - 13 - 16 - - - - - - 400 - 75 - - - Item1 - - 1048576 - 2147483647 - 1 - - NSImage - NSMenuCheckmark - - - NSImage - NSMenuMixedState - - _popUpItemAction: - - - YES - - - OtherViews - - - - - - Item2 - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - Item3 - - 1048576 - 2147483647 - - - _popUpItemAction: - - - - - 3 - YES - YES - 1 - - NO - - - - 256 - {{40, 266}, {65, 17}} - - - - YES - - 67108864 - 71303168 - RGV2aWNlOgo - - - - 6 - System - controlColor - - 3 - MC42NjY2NjY2NjY3AA - - - - 6 - System - controlTextColor - - 3 - MAA - - - - NO - - - - 256 - {{43, 117}, {77, 77}} - - - - MyAnalogStick - NSView - - - - 256 - {{123, 43}, {77, 77}} - - - - MyDigitalStick - NSView - - - - 256 - {{226, 43}, {77, 77}} - - - - MyAnalogStick - NSView - - - - 256 - {{306, 117}, {77, 77}} - - - - MyMainButtons - NSView - - - - 256 - {{151, 141}, {126, 39}} - - - - MyCentreButtons - NSView - - - - 256 - {{43, 202}, {77, 18}} - - - - MyShoulderButton - NSView - - - - 256 - {{306, 202}, {77, 18}} - - - - MyShoulderButton - NSView - - - - 1280 - {{41, 224}, {161, 20}} - - - - 16392 - 255 - - - - 1280 - {{224, 224}, {161, 20}} - - - - 16392 - 255 - - - - 256 - {{41, 93}, {71, 18}} - - - - YES - - 67108864 - 0 - Invert X - - - 1211912448 - 2 - - NSSwitch - - - - 200 - 25 - - NO - - - - 256 - {{41, 73}, {71, 18}} - - - - YES - - 67108864 - 0 - Invert Y - - - 1211912448 - 2 - - - - 200 - 25 - - NO - - - - 256 - {{309, 81}, {71, 18}} - - - - YES - - 67108864 - 0 - Invert X - - - 1211912448 - 2 - - - - 200 - 25 - - NO - - - - 256 - {{309, 61}, {71, 18}} - - - - YES - - 67108864 - 0 - Invert Y - - - 1211912448 - 2 - - - - 200 - 25 - - NO - - - - 256 - {{224, 16}, {161, 21}} - - - - YES - - 67108864 - 0 - - - - - Helvetica - 12 - 16 - - - 32768 - 0.0 - 50 - 0.0 - 0 - 1 - NO - NO - - NO - - - - 256 - {{41, 53}, {64, 18}} - - - - YES - - 67108864 - 0 - Linked - - - 1211912448 - 2 - - - - 200 - 25 - - NO - - - - 256 - {{309, 41}, {64, 18}} - - - - YES - - 67108864 - 0 - Linked - - - 1211912448 - 2 - - - - 200 - 25 - - NO - - - - 256 - - - - 274 - - - - 256 - {{13, 193}, {153, 14}} - - - - YES - - 67108864 - 272629760 - Xbox 360 Controller Driver - - LucidaGrande - 11 - 3100 - - - - - - NO - - - - 256 - {{13, 173}, {129, 17}} - - - - YES - - 67108864 - 272629760 - Version 0.12 - - LucidaGrande - 10 - 2843 - - - - - - NO - - - - 256 - {{13, 157}, {129, 17}} - - - - YES - - 67108864 - 272629760 - (C) 2006-13 Colin Munro - - - - - - NO - - - - 256 - {{10, 138}, {129, 14}} - - - - YES - - 69206017 - 272629760 - http://tattiebogle.net/ - - - - - - NO - - - - 256 - {{10, 116}, {153, 14}} - - - - YES - - 69206017 - 272629760 - http://mice-software.com/ - - - - - - NO - - - - 256 - {{13, 11}, {150, 97}} - - - YES - - 67108864 - 272629760 - Rm9yIG1vcmUgaW5mb3JtYXRpb24gb24gdGhpcyBkcml2ZXIsIHBsZWFzZSBzZWUgdGhlIHN1cHBsaWVk -IFJlYWRtZSBhbmQgTGljZW5jZSBkb2N1bWVudHMuCgpQbGVhc2UgY29uc2lkZXIgZG9uYXRpbmcgaWYg -eW91IGVuam95IHRoaXMgZHJpdmVyIQ - - - - - - NO - - - {{2, 2}, {179, 218}} - - - - - - {{395, 16}, {183, 235}} - - - - {0, 0} - - 67108864 - 0 - About - - - 6 - System - textBackgroundColor - - 3 - MQA - - - - 3 - MCAwLjgwMDAwMDAxMTkAA - - - - 3 - 0 - 2 - NO - - - - 256 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{197, 190}, {32, 24}} - - - - YES - - 134217728 - 33554432 - - NSImage - battNone - - 0 - 1 - 0 - YES - - NO - YES - - - - 268 - {{17, 40}, {21, 156}} - - - - YES - - 67108864 - 0 - - - 32768 - 0.0 - 50 - 0.0 - 0 - 0 - NO - YES - - NO - - - - -2147483380 - {{8, 254}, {39, 38}} - - - - YES - - 67108864 - 134217728 - + - - LucidaGrande - 18 - 16 - - - -2034499584 - 7 - - - 200 - 25 - - NO - - - - -2147483380 - {{62, 9}, {118, 32}} - - - - YES - - 67108864 - 134217728 - Power off - - - -2038284288 - 129 - - - 200 - 25 - - NO - - - {595, 304} - - - - - {{0, 0}, {1280, 1002}} - {595, 32} - {10000000000000, 10000000000000} - YES - - - 15 - 2 - {{131, 166}, {519, 336}} - 1685585920 - Window - NSWindow - - - {490, 150} - - - 256 - - - - 274 - - - - 2304 - - - - 256 - {477, 229} - - YES - NO - YES - - - -2147483392 - {{224, 0}, {16, 17}} - - - - enable - 20 - 20 - 20 - - 75497536 - 2048 - - - - 3 - MC4zMzMzMzI5ODU2AA - - - 6 - System - headerTextColor - - - - - 67108864 - 131072 - - - - 1211912448 - 2 - - NSImage - NSSwitch - - - - - 200 - 25 - - 1 - YES - YES - - - - name - 451 - 40 - 1000 - - 75497536 - 2048 - - - - - - - 337641536 - 2048 - Text Cell - - - - 6 - System - controlBackgroundColor - - - - - 1 - YES - - - - 3 - 2 - - - 6 - System - gridColor - - 3 - MC41AA - - - 17 - -700448768 - - - 4 - 15 - 0 - YES - 0 - 1 - - - {{1, 1}, {477, 229}} - - - - - 4 - - - - -2147483392 - {{224, 17}, {15, 102}} - - NO - - _doScroller: - 0.9925373134328358 - - - - -2147483392 - {{-100, -100}, {223, 15}} - - NO - 1 - - _doScroller: - 0.57142859697341919 - - - {{20, 60}, {479, 231}} - - - 133650 - - - - QSAAAEEgAABBmAAAQZgAAA - 0.25 - 4 - 1 - - - - 268 - {{17, 299}, {355, 17}} - - YES - - 68157504 - 272630784 - Select the devices you would like to use with the driver: - - - - - - NO - - - - 289 - {{409, 12}, {96, 32}} - - YES - - 67108864 - 134217728 - Done - - - -2038284288 - 129 - - - 200 - 25 - - NO - - - - 292 - {{17, 16}, {323, 28}} - - YES - - 68157504 - 272630784 - To save changes to this list, you must enter your password.
A restart will be required for changes to take effect. - - LucidaGrande - 11 - 16 - - - - - - NO - - - {519, 336} - - {{0, 0}, {1280, 1002}} - {490, 172} - {10000000000000, 10000000000000} - YES - - - DeviceLister - - - - - - - _window - - - - 26 - - - - leftStickInvertY - - - - 127 - - - - rightStickInvertX - - - - 128 - - - - rightStickInvertY - - - - 129 - - - - deviceList - - - - 130 - - - - rightStickDeadzone - - - - 134 - - - - rightStick - - - - 136 - - - - leftTrigger - - - - 137 - - - - rightTrigger - - - - 138 - - - - leftShoulder - - - - 139 - - - - rightShoulder - - - - 140 - - - - digiStick - - - - 141 - - - - centreButtons - - - - 142 - - - - rightButtons - - - - 143 - - - - leftStick - - - - 144 - - - - leftStickInvertX - - - - 145 - - - - selectDevice: - - - - 146 - - - - changeSetting: - - - - 151 - - - - changeSetting: - - - - 152 - - - - changeSetting: - - - - 153 - - - - changeSetting: - - - - 154 - - - - changeSetting: - - - - 155 - - - - leftLinked - - - - 169 - - - - rightLinked - - - - 170 - - - - changeSetting: - - - - 171 - - - - changeSetting: - - - - 172 - - - - batteryLevel - - - - 175 - - - - changeSetting: - - - - 196 - - - - leftStickDeadzone - - - - 197 - - - - showDeviceList: - - - - 220 - - - - deviceLister - - - - 226 - - - - powerOff: - - - - 229 - - - - powerOff - - - - 230 - - - - dataSource - - - - 225 - - - - done: - - - - 222 - - - - sheet - - - - 223 - - - - list - - - - 224 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - 12 - - - - - - PrefPane - - - 6 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 98 - - - - - - - - 103 - - - - - - - - 104 - - - - - 105 - - - - - 106 - - - - - 107 - - - - - 108 - - - - - 109 - - - - - 110 - - - - - 111 - - - - - 112 - - - - - 114 - - - - - - - - 115 - - - - - - - - 116 - - - - - - - - 117 - - - - - - - - 120 - - - - - - - - 156 - - - - - - - - 157 - - - - - - - - 158 - - - - - - - - - - - - - 174 - - - - - - - - 177 - - - - - - - - 178 - - - - - 179 - - - - - 180 - - - - - 181 - - - - - 182 - - - - - 184 - - - - - 185 - - - - - 186 - - - - - 193 - - - - - 99 - - - - - - - - - - 102 - - - - - 101 - - - - - 100 - - - - - -3 - - - Application - - - 161 - - - - - - - - 187 - - - - - 163 - - - - - - - - 188 - - - - - 165 - - - - - - - - 189 - - - - - 166 - - - - - - - - 190 - - - - - 167 - - - - - - - - 191 - - - - - 168 - - - - - - - - 192 - - - - - 194 - - - - - - - - 195 - - - - - 198 - - - - - - - - 199 - - - - - 200 - - - - - - DeviceSheet - - - 201 - - - - - - - - - - - 202 - - - - - - - - - - 203 - - - - - 204 - - - - - 205 - - - - - - - - - 207 - - - - - - - - 208 - - - - - - - - 209 - - - - - 211 - - - - - 214 - - - - - - - - 215 - - - - - 216 - - - - - - - - 217 - - - - - 218 - - - - - - - - 219 - - - - - 221 - - - - - 227 - - - - - - - - 228 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{326, 482}, {595, 304}} - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - {{349, 211}, {519, 336}} - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 230 - - - - - DeviceLister - NSObject - - done: - id - - - done: - - done: - id - - - - NSTableView - NSWindow - - - - list - NSTableView - - - sheet - NSWindow - - - - IBProjectSource - ./Classes/DeviceLister.h - - - - MyAnalogStick - NSView - - IBProjectSource - ./Classes/MyAnalogStick.h - - - - MyCentreButtons - NSView - - IBProjectSource - ./Classes/MyCentreButtons.h - - - - MyDigitalStick - NSView - - IBProjectSource - ./Classes/MyDigitalStick.h - - - - MyMainButtons - NSView - - IBProjectSource - ./Classes/MyMainButtons.h - - - - MyShoulderButton - NSView - - IBProjectSource - ./Classes/MyShoulderButton.h - - - - NSPreferencePane - NSObject - - NSView - NSView - NSView - NSWindow - - - - _firstKeyView - NSView - - - _initialKeyView - NSView - - - _lastKeyView - NSView - - - _window - NSWindow - - - - IBProjectSource - ./Classes/NSPreferencePane.h - - - - Pref360ControlPref - NSPreferencePane - - id - id - - - - powerOff: - id - - - showDeviceList: - id - - - - NSImageView - MyCentreButtons - NSPopUpButton - DeviceLister - MyDigitalStick - NSButton - MyShoulderButton - MyAnalogStick - NSSlider - NSButton - NSButton - NSProgressIndicator - NSButton - MyMainButtons - NSButton - MyShoulderButton - MyAnalogStick - NSSlider - NSButton - NSButton - NSProgressIndicator - - - - batteryLevel - NSImageView - - - centreButtons - MyCentreButtons - - - deviceList - NSPopUpButton - - - deviceLister - DeviceLister - - - digiStick - MyDigitalStick - - - leftLinked - NSButton - - - leftShoulder - MyShoulderButton - - - leftStick - MyAnalogStick - - - leftStickDeadzone - NSSlider - - - leftStickInvertX - NSButton - - - leftStickInvertY - NSButton - - - leftTrigger - NSProgressIndicator - - - powerOff - NSButton - - - rightButtons - MyMainButtons - - - rightLinked - NSButton - - - rightShoulder - MyShoulderButton - - - rightStick - MyAnalogStick - - - rightStickDeadzone - NSSlider - - - rightStickInvertX - NSButton - - - rightStickInvertY - NSButton - - - rightTrigger - NSProgressIndicator - - - - IBProjectSource - ./Classes/Pref360ControlPref.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - YES - 3 - - {11, 11} - {10, 3} - {15, 15} - {32, 24} - - - diff --git a/Pref360Control/English.lproj/Pref360ControlPref.nib/keyedobjects.nib b/Pref360Control/English.lproj/Pref360ControlPref.nib/keyedobjects.nib deleted file mode 100644 index 00668ec..0000000 Binary files a/Pref360Control/English.lproj/Pref360ControlPref.nib/keyedobjects.nib and /dev/null differ diff --git a/Pref360Control/Info.plist b/Pref360Control/Info.plist index 29c9273..1d69d93 100644 --- a/Pref360Control/Info.plist +++ b/Pref360Control/Info.plist @@ -3,32 +3,32 @@ CFBundleDevelopmentRegion - English + en CFBundleExecutable - Pref360Control - CFBundleIconFile - + ${EXECUTABLE_NAME} CFBundleIdentifier com.mice.driver.360Controller.Prefs CFBundleInfoDictionaryVersion 6.0 + CFBundleName + XBox 360 Controllers CFBundlePackageType BNDL CFBundleShortVersionString - 1.0 + ${CURRENT_PROJECT_VERSION} CFBundleSignature - ???? + 360D CFBundleVersion - 1.0 + ${CURRENT_PROJECT_VERSION} + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} NSMainNibFile Pref360ControlPref NSPrefPaneIconFile - Pref360ControlPref.tiff + pref360controlpref.tiff + NSPrefPaneIconLabel + Xbox 360 Controllers NSPrincipalClass Pref360ControlPref - CFBundleName - XBox 360 Controllers - NSPrefPaneIconLabel - Xbox 360\nControllers diff --git a/Pref360Control/MyAnalogStick.h b/Pref360Control/MyAnalogStick.h index a95fdd2..047eb4b 100644 --- a/Pref360Control/MyAnalogStick.h +++ b/Pref360Control/MyAnalogStick.h @@ -23,17 +23,18 @@ #import @interface MyAnalogStick : NSView -{ - int deadzone; - int x,y; - BOOL pressed,linked; -} +@property (nonatomic) int deadzone; +@property (nonatomic) int positionX; +@property (nonatomic) int positionY; +@property (nonatomic) int realPositionX; +@property (nonatomic) int realPositionY; +@property (nonatomic) BOOL pressed; +@property (nonatomic) BOOL linked; +@property (nonatomic) BOOL normalized; -- (void)setDeadzone:(int)pos; +- (void)setPositionX:(int)positionX; +- (void)setNormalized:(BOOL)isNormalized; +- (void)setPositionY:(int)positionY; - (void)setPositionX:(int)xPos y:(int)yPos; -- (void)setPositionX:(int)xPos; -- (void)setPositionY:(int)xPos; -- (void)setPressed:(BOOL)pressedState; -- (void)setLinked:(BOOL)linkedState; @end diff --git a/Pref360Control/MyAnalogStick.m b/Pref360Control/MyAnalogStick.m index cfb6392..3729997 100644 --- a/Pref360Control/MyAnalogStick.m +++ b/Pref360Control/MyAnalogStick.m @@ -22,40 +22,110 @@ */ #import "MyAnalogStick.h" -#define PRESSED_INSET 5 -#define AREA_INSET 4 +#define PRESSED_INSET 5 +#define AREA_INSET 4 @implementation MyAnalogStick +@synthesize pressed; +@synthesize deadzone; +@synthesize positionX = x; +@synthesize positionY = y; +@synthesize realPositionX = realX; +@synthesize realPositionY = realY; +@synthesize normalized = normalized; +@synthesize linked; -- (id)initWithFrame:(NSRect)frameRect +- (void)setPressed:(BOOL)apressed { - if ((self = [super initWithFrame:frameRect]) != nil) { - deadzone=0; - x=0; - y=0; - pressed=FALSE; - linked=FALSE; - } - return self; + pressed = apressed; + self.needsDisplay = YES; +} + +- (void)setDeadzone:(int)adeadzone +{ + deadzone = adeadzone; + self.needsDisplay = YES; +} + +- (void)setPositionX:(int)positionX +{ + x = positionX; + + if (normalized) + { + const UInt16 max16 = 32767; + float maxVal = max16 - deadzone; + + if (x > 0) + realX = (abs(x) * maxVal / max16) + deadzone + 1; + else if (x < 0) + realX = -((abs(x) * maxVal / max16) + deadzone + 1); + else // x == 0 + realX = 0; + } + else + { + realX = 0; + } + + self.needsDisplay = YES; +} + +- (void)setPositionY:(int)positionY +{ + y = positionY; + + if (normalized) + { + const UInt16 max16 = 32767; + float maxVal = max16 - deadzone; + + if (y > 0) + realY = (abs(y) * maxVal / max16) + deadzone + 1; + else if (y < 0) + realY = -((abs(y) * maxVal / max16) + deadzone + 1); + else // y == 0 + realY = 0; + } + else + { + realY = 0; + } + + self.needsDisplay = YES; +} + +- (void)setNormalized:(BOOL)isNormalized +{ + normalized = isNormalized; +} + +- (void)setLinked:(BOOL)alinked +{ + linked = alinked; + self.needsDisplay = YES; } - (void)drawRect:(NSRect)rect { - NSRect area,deadRect,posRect; + NSRect area = [self bounds], deadRect, posRect, realPosRect; // Compute positions - // Area - area=[self bounds]; - // Deadzone - deadRect.size.width=(deadzone*area.size.width)/32768; - deadRect.size.height=(deadzone*area.size.height)/32768; - deadRect.origin.x=area.origin.x+((area.size.width-deadRect.size.width)/2); - deadRect.origin.y=area.origin.y+((area.size.height-deadRect.size.height)/2); - // Position - posRect.size.width=4; - posRect.size.height=4; - posRect.origin.x=area.origin.x+AREA_INSET+(((x+32768)*(area.size.width-(AREA_INSET*2)))/65536)-(posRect.size.width/2); - posRect.origin.y=area.origin.y+area.size.height-AREA_INSET-(((y+32768)*(area.size.height-(AREA_INSET*2)))/65536)-(posRect.size.height/2); + // Deadzone + deadRect.size.width = (deadzone * area.size.width) / 32768; + deadRect.size.height = (deadzone * area.size.height) / 32768; + deadRect.origin.x = area.origin.x + ((area.size.width - deadRect.size.width) / 2); + deadRect.origin.y = area.origin.y + ((area.size.height - deadRect.size.height) / 2); + // Position + posRect.size.width = 4; + posRect.size.height = 4; + posRect.origin.x = area.origin.x + AREA_INSET + (((x + 32768) * (area.size.width - (AREA_INSET * 2))) / 65536) - (posRect.size.width / 2); + posRect.origin.y = area.origin.y + area.size.height - AREA_INSET - (((y + 32768) * (area.size.height - (AREA_INSET * 2))) / 65536) - (posRect.size.height / 2); + // Real Position + realPosRect.size.width = 4; + realPosRect.size.height = 4; + realPosRect.origin.x = area.origin.x + AREA_INSET + (((realX + 32768) * (area.size.width - (AREA_INSET * 2))) / 65536) - (posRect.size.width / 2); + realPosRect.origin.y = area.origin.y + area.size.height - AREA_INSET - (((realY + 32768) * (area.size.height - (AREA_INSET * 2))) / 65536) - (posRect.size.height / 2); // Draw border NSDrawLightBezel(area,area); // Draw pressed state @@ -63,71 +133,50 @@ - (void)drawRect:(NSRect)rect NSRect pressArea; pressArea=area; - pressArea.origin.x+=PRESSED_INSET; - pressArea.origin.y+=PRESSED_INSET; - pressArea.size.width-=PRESSED_INSET*2; - pressArea.size.height-=PRESSED_INSET*2; + pressArea.origin.x += PRESSED_INSET; + pressArea.origin.y += PRESSED_INSET; + pressArea.size.width -= PRESSED_INSET * 2; + pressArea.size.height -= PRESSED_INSET * 2; [[NSColor blackColor] set]; NSRectFill(pressArea); } // Draw deadzone - if(deadzone!=0) { + if (deadzone != 0) { [[NSColor redColor] set]; - if(linked) NSFrameRect(deadRect); + if (linked) NSFrameRect(deadRect); else { NSRect trueRect; - trueRect=deadRect; - trueRect.origin.x=area.origin.x; - trueRect.size.width=area.size.width; + trueRect = deadRect; + trueRect.origin.x = area.origin.x; + trueRect.size.width = area.size.width; NSFrameRect(trueRect); - trueRect=deadRect; - trueRect.origin.y=area.origin.y; - trueRect.size.height=area.size.height; + trueRect = deadRect; + trueRect.origin.y = area.origin.y; + trueRect.size.height = area.size.height; NSFrameRect(trueRect); } } + // Draw real position + if (realX || realY) + { + if (pressed) [[NSColor colorWithDeviceWhite:.3 alpha:1] set]; + else [[NSColor colorWithDeviceWhite:.7 alpha:1] set]; + NSRectFill(realPosRect); + } // Draw position - if(pressed) [[NSColor whiteColor] set]; + if (pressed) [[NSColor whiteColor] set]; else [[NSColor blackColor] set]; NSRectFill(posRect); } -- (void)setDeadzone:(int)pos -{ - deadzone=pos; - [self setNeedsDisplay:YES]; -} - - (void)setPositionX:(int)xPos y:(int)yPos { - x=xPos; - y=yPos; - [self setNeedsDisplay:YES]; -} - -- (void)setPositionX:(int)xPos -{ - x=xPos; - [self setNeedsDisplay:YES]; -} - -- (void)setPositionY:(int)yPos -{ - y=yPos; - [self setNeedsDisplay:YES]; -} - -- (void)setPressed:(BOOL)pressedState -{ - pressed=pressedState; - [self setNeedsDisplay:YES]; -} - -- (void)setLinked:(BOOL)linkedState -{ - linked=linkedState; - [self setNeedsDisplay:YES]; + // This does not trigger the key-value observer. + x = xPos; + // This does. + // Done so the setNeedsDisplay: is only called once + self.positionY = yPos; } @end diff --git a/Pref360Control/MyBatteryMonitor.h b/Pref360Control/MyBatteryMonitor.h new file mode 100644 index 0000000..e46a407 --- /dev/null +++ b/Pref360Control/MyBatteryMonitor.h @@ -0,0 +1,14 @@ +// +// MyBatteryMonitor.h +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import + +@interface MyBatteryMonitor : NSView + +@property (nonatomic) int bars; + +@end diff --git a/Pref360Control/MyBatteryMonitor.m b/Pref360Control/MyBatteryMonitor.m new file mode 100644 index 0000000..06ae33e --- /dev/null +++ b/Pref360Control/MyBatteryMonitor.m @@ -0,0 +1,24 @@ +// +// MyBatteryMonitor.m +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import "MyBatteryMonitor.h" +#import "Pref360StyleKit.h" + +@implementation MyBatteryMonitor + +- (void)setBars:(int)value { + _bars = value; + [self setNeedsDisplay:YES]; +} + +- (void)drawRect:(NSRect)dirtyRect { + [super drawRect:dirtyRect]; + + [Pref360StyleKit drawBatteryMonitorWithBars:_bars]; +} + +@end diff --git a/Pref360Control/MyCentreButtons.h b/Pref360Control/MyCentreButtons.h index 97168d5..f149d7f 100644 --- a/Pref360Control/MyCentreButtons.h +++ b/Pref360Control/MyCentreButtons.h @@ -23,12 +23,7 @@ #import @interface MyCentreButtons : NSView -{ - BOOL back,start,appSpecific; -} - -- (void)setBack:(BOOL)bBack; -- (void)setStart:(BOOL)bStart; -- (void)setSpecific:(BOOL)bSpecific; - +@property (nonatomic) BOOL back; +@property (nonatomic) BOOL start; +@property (nonatomic) BOOL specific; @end diff --git a/Pref360Control/MyCentreButtons.m b/Pref360Control/MyCentreButtons.m index 663ace1..705b261 100644 --- a/Pref360Control/MyCentreButtons.m +++ b/Pref360Control/MyCentreButtons.m @@ -19,77 +19,71 @@ You should have received a copy of the GNU General Public License along with Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/#import "MyCentreButtons.h" +*/ + +#import "MyCentreButtons.h" @implementation MyCentreButtons +@synthesize back; +@synthesize start; +@synthesize specific = appSpecific; + +- (void)setBack:(BOOL)aback +{ + back = aback; + self.needsDisplay = YES; +} -- (id)initWithFrame:(NSRect)frameRect +- (void)setStart:(BOOL)astart { - if ((self = [super initWithFrame:frameRect]) != nil) { - back=start=appSpecific=FALSE; - } - return self; + start = astart; + self.needsDisplay = YES; } -- (void)drawButton:(NSString*)button inRectangle:(NSRect)rect pressed:(BOOL)down +- (void)setSpecific:(BOOL)specific { - NSBezierPath *path; + appSpecific = specific; + self.needsDisplay = YES; +} + ++ (void)drawButton:(NSString*)button inRectangle:(NSRect)rect pressed:(BOOL)down +{ + NSBezierPath *path = [NSBezierPath bezierPathWithOvalInRect:rect]; NSSize size; NSDictionary *attributes; NSPoint point; - NSColor *colour; + NSColor *colour = [NSColor blackColor]; // Draw circle - path=[NSBezierPath bezierPathWithOvalInRect:rect]; - colour=[NSColor blackColor]; [colour set]; if(down) { [path fill]; - colour=[NSColor whiteColor]; + colour = [NSColor whiteColor]; } else [path stroke]; // Draw text - attributes=[NSDictionary dictionaryWithObject:colour forKey:NSForegroundColorAttributeName]; - size=[button sizeWithAttributes:attributes]; - point.x=rect.origin.x+((rect.size.width-size.width)/2); - point.y=rect.origin.y+((rect.size.height-size.height)/2); + attributes = @{NSForegroundColorAttributeName: colour}; + size = [button sizeWithAttributes:attributes]; + point.x = rect.origin.x + ((rect.size.width - size.width) / 2); + point.y = rect.origin.y + ((rect.size.height - size.height) / 2); [button drawAtPoint:point withAttributes:attributes]; } - (void)drawRect:(NSRect)rect { - NSRect area,button; - - area=[self bounds]; - button.size.height=area.size.height/2; - button.size.width=area.size.width/4; - button.origin.x=area.origin.x; - button.origin.y=area.origin.y+((area.size.height-button.size.height)/2); - [self drawButton:@"Back" inRectangle:button pressed:back]; - button.origin.x=area.origin.x+area.size.width-button.size.width; - [self drawButton:@"Start" inRectangle:button pressed:start]; - button.size.height=area.size.height-2; - button.size.width=button.size.height; - button.origin.x=area.origin.x+((area.size.width-button.size.width)/2); - button.origin.y=area.origin.y+1; - [self drawButton:@"" inRectangle:button pressed:appSpecific]; -} - -- (void)setBack:(BOOL)bBack -{ - back=bBack; - [self setNeedsDisplay:TRUE]; -} - -- (void)setStart:(BOOL)bStart -{ - start=bStart; - [self setNeedsDisplay:TRUE]; -} + NSRect area = [self bounds], button; -- (void)setSpecific:(BOOL)bSpecific -{ - appSpecific=bSpecific; - [self setNeedsDisplay:TRUE]; + button.size.height = area.size.height / 2; + button.size.width = area.size.width / 4; + button.origin.x = area.origin.x; + button.origin.y = area.origin.y + ((area.size.height - button.size.height) / 2); + [MyCentreButtons drawButton:@"Back" inRectangle:button pressed:back]; + button.origin.x = area.origin.x + area.size.width - button.size.width; + [MyCentreButtons drawButton:@"Start" inRectangle:button pressed:start]; + button.size.height = area.size.height - 2; + button.size.width = button.size.height; + button.origin.x = area.origin.x + ((area.size.width-button.size.width) / 2); + button.origin.y = area.origin.y + 1; + [MyCentreButtons drawButton:@"" inRectangle:button pressed:appSpecific]; } @end diff --git a/Pref360Control/MyDeadZoneViewer.h b/Pref360Control/MyDeadZoneViewer.h new file mode 100644 index 0000000..02f63e2 --- /dev/null +++ b/Pref360Control/MyDeadZoneViewer.h @@ -0,0 +1,15 @@ +// +// MyDeadZoneViewer.h +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import + +@interface MyDeadZoneViewer : NSView + +@property (nonatomic) double val; +@property (nonatomic) BOOL linked; + +@end diff --git a/Pref360Control/MyDeadZoneViewer.m b/Pref360Control/MyDeadZoneViewer.m new file mode 100644 index 0000000..383693c --- /dev/null +++ b/Pref360Control/MyDeadZoneViewer.m @@ -0,0 +1,29 @@ +// +// MyDeadZoneViewer.m +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import "MyDeadZoneViewer.h" +#import "Pref360StyleKit.h" + +@implementation MyDeadZoneViewer + +-(void)setVal:(double)value { + _val = value; + [self setNeedsDisplay:YES]; +} + +- (void)setLinked:(BOOL)linked { + _linked = linked; + [self setNeedsDisplay:YES]; +} + +- (void)drawRect:(NSRect)dirtyRect { + [super drawRect:dirtyRect]; + + [Pref360StyleKit drawDeadZoneViewerWithValue:_val / 32768 linked:_linked]; +} + +@end diff --git a/Pref360Control/MyDigitalStick.h b/Pref360Control/MyDigitalStick.h index f8ac425..ceeb078 100644 --- a/Pref360Control/MyDigitalStick.h +++ b/Pref360Control/MyDigitalStick.h @@ -23,14 +23,8 @@ #import @interface MyDigitalStick : NSView -{ - NSBezierPath *up,*down,*left,*right; - BOOL bUp,bDown,bLeft,bRight; -} - -- (void)setUp:(BOOL)upState; -- (void)setDown:(BOOL)downState; -- (void)setLeft:(BOOL)leftState; -- (void)setRight:(BOOL)rightState; - +@property (nonatomic) BOOL up; +@property (nonatomic) BOOL down; +@property (nonatomic) BOOL left; +@property (nonatomic) BOOL right; @end diff --git a/Pref360Control/MyDigitalStick.m b/Pref360Control/MyDigitalStick.m index 3be6b1a..258301a 100644 --- a/Pref360Control/MyDigitalStick.m +++ b/Pref360Control/MyDigitalStick.m @@ -22,14 +22,47 @@ */ #import "MyDigitalStick.h" -#define INSET_AMOUNT 10 +#define INSET_AMOUNT 10 @implementation MyDigitalStick +{ +@private + NSBezierPath *up, *down, *left, *right; +} +@synthesize up = bUp; +@synthesize down = bDown; +@synthesize left = bLeft; +@synthesize right = bRight; + +- (void)setUp:(BOOL)anup +{ + bUp = anup; + self.needsDisplay = YES; +} + +- (void)setDown:(BOOL)adown +{ + bDown = adown; + self.needsDisplay = YES; +} -- (NSBezierPath*)makeTriangle:(int)start inRectangle:(NSRect)rect; +- (void)setLeft:(BOOL)aleft { - NSBezierPath *path; - NSPoint centre,point; + bLeft = aleft; + self.needsDisplay = YES; +} + +- (void)setRight:(BOOL)aright +{ + bRight = aright; + self.needsDisplay = YES; +} + ++ (NSBezierPath*)makeTriangle:(int)start inRectangle:(NSRect)rect; +{ + // Create path + NSBezierPath *path = [NSBezierPath bezierPath]; + NSPoint centre, point; const int mult[][2]={ {0,0}, {1,0}, @@ -39,94 +72,56 @@ - (NSBezierPath*)makeTriangle:(int)start inRectangle:(NSRect)rect; }; // Find central part - centre.x=rect.origin.x+(rect.size.width/2); - centre.y=rect.origin.y+(rect.size.height/2); - // Create path - path=[NSBezierPath bezierPath]; + centre.x = rect.origin.x + (rect.size.width / 2); + centre.y = rect.origin.y + (rect.size.height / 2); // Make triangle [path moveToPoint:centre]; - point.x=rect.origin.x+(rect.size.width*mult[start][0]); - point.y=rect.origin.y+(rect.size.height*mult[start][1]); + point.x = rect.origin.x + (rect.size.width * mult[start][0]); + point.y = rect.origin.y + (rect.size.height * mult[start][1]); [path lineToPoint:point]; - point.x=rect.origin.x+(rect.size.width*mult[start+1][0]); - point.y=rect.origin.y+(rect.size.height*mult[start+1][1]); + point.x = rect.origin.x + (rect.size.width * mult[start + 1][0]); + point.y = rect.origin.y + (rect.size.height * mult[start + 1][1]); [path lineToPoint:point]; [path closePath]; // Done - return [path retain]; + return path; } - (id)initWithFrame:(NSRect)frameRect { - if ((self = [super initWithFrame:frameRect]) != nil) { - NSRect rect,triangle; + if ((self = [super initWithFrame:frameRect]) != nil) { + NSRect rect = [self bounds], triangle; - bUp=bDown=bLeft=bRight=FALSE; - rect=[self bounds]; - triangle.origin.x+=INSET_AMOUNT; - triangle.origin.y+=INSET_AMOUNT; - triangle.size.width-=INSET_AMOUNT*2; - triangle.size.height-=INSET_AMOUNT*2; - triangle.size.width=rect.size.width/3; - triangle.size.height=rect.size.height/3; - triangle.origin.y=rect.origin.y+(triangle.size.height*2); - triangle.origin.x=rect.origin.x+triangle.size.width; - up=[self makeTriangle:0 inRectangle:triangle]; - triangle.origin.y=rect.origin.y; - down=[self makeTriangle:2 inRectangle:triangle]; - triangle.origin.y=rect.origin.y+triangle.size.height; - triangle.origin.x=rect.origin.x; - left=[self makeTriangle:1 inRectangle:triangle]; - triangle.origin.x=rect.origin.x+(triangle.size.width*2); - right=[self makeTriangle:3 inRectangle:triangle]; - } - return self; -} - -- (void)dealloc -{ - [up release]; - [down release]; - [left release]; - [right release]; - [super dealloc]; + triangle.origin.x = INSET_AMOUNT; + triangle.origin.y = INSET_AMOUNT; + triangle.size.width =- INSET_AMOUNT * 2; + triangle.size.height =- INSET_AMOUNT * 2; + triangle.size.width = rect.size.width / 3; + triangle.size.height = rect.size.height / 3; + triangle.origin.y = rect.origin.y + (triangle.size.height * 2); + triangle.origin.x = rect.origin.x + triangle.size.width; + up = [MyDigitalStick makeTriangle:0 inRectangle:triangle]; + triangle.origin.y = rect.origin.y; + down = [MyDigitalStick makeTriangle:2 inRectangle:triangle]; + triangle.origin.y = rect.origin.y + triangle.size.height; + triangle.origin.x = rect.origin.x; + left = [MyDigitalStick makeTriangle:1 inRectangle:triangle]; + triangle.origin.x = rect.origin.x + (triangle.size.width * 2); + right = [MyDigitalStick makeTriangle:3 inRectangle:triangle]; + } + return self; } - (void)drawRect:(NSRect)rect { - NSRect area; + NSRect area = [self bounds]; - area=[self bounds]; - NSDrawLightBezel(area,area); + NSDrawLightBezel(area, area); [[NSColor blackColor] set]; - if(bUp) [up fill]; - if(bDown) [down fill]; - if(bLeft) [left fill]; - if(bRight) [right fill]; -} - -- (void)setUp:(BOOL)upState -{ - bUp=upState; - [self setNeedsDisplay:TRUE]; -} - -- (void)setDown:(BOOL)downState -{ - bDown=downState; - [self setNeedsDisplay:TRUE]; -} - -- (void)setLeft:(BOOL)leftState -{ - bLeft=leftState; - [self setNeedsDisplay:TRUE]; -} - -- (void)setRight:(BOOL)rightState -{ - bRight=rightState; - [self setNeedsDisplay:TRUE]; + if (bUp) [up fill]; + if (bDown) [down fill]; + if (bLeft) [left fill]; + if (bRight) [right fill]; } @end diff --git a/Pref360Control/MyMainButtons.h b/Pref360Control/MyMainButtons.h index 3024411..765294c 100644 --- a/Pref360Control/MyMainButtons.h +++ b/Pref360Control/MyMainButtons.h @@ -23,13 +23,8 @@ #import @interface MyMainButtons : NSView -{ - BOOL a,b,x,y; -} - -- (void)setA:(BOOL)aVal; -- (void)setB:(BOOL)bVal; -- (void)setX:(BOOL)xVal; -- (void)setY:(BOOL)yVal; - +@property (nonatomic) BOOL a; +@property (nonatomic) BOOL b; +@property (nonatomic) BOOL x; +@property (nonatomic) BOOL y; @end diff --git a/Pref360Control/MyMainButtons.m b/Pref360Control/MyMainButtons.m index 4d1f6f7..3fc9ba8 100644 --- a/Pref360Control/MyMainButtons.m +++ b/Pref360Control/MyMainButtons.m @@ -22,98 +22,88 @@ */ #import "MyMainButtons.h" -#define MINI_OFFSET 2 +#define MINI_OFFSET 2 @implementation MyMainButtons +@synthesize a; +@synthesize b; +@synthesize x; +@synthesize y; -- (id)initWithFrame:(NSRect)frameRect +- (void)setA:(BOOL)aa { - if ((self = [super initWithFrame:frameRect]) != nil) { - a=b=x=y=FALSE; - } - return self; + a = aa; + self.needsDisplay = YES; } -- (void)drawButton:(NSString*)button inRectangle:(NSRect)rect pressed:(BOOL)down +- (void)setB:(BOOL)aa { - NSBezierPath *path; + b = aa; + self.needsDisplay = YES; +} + +- (void)setX:(BOOL)aa +{ + x = aa; + self.needsDisplay = YES; +} + +- (void)setY:(BOOL)aa +{ + y = aa; + self.needsDisplay = YES; +} + ++ (void)drawButton:(NSString*)button inRectangle:(NSRect)rect pressed:(BOOL)down +{ + NSBezierPath *path = [NSBezierPath bezierPathWithOvalInRect:rect]; NSSize size; NSDictionary *attributes; NSPoint point; - NSColor *colour; - NSRect bling; + NSColor *colour = [NSColor blackColor]; + NSRect bling = rect; // Draw circle - path=[NSBezierPath bezierPathWithOvalInRect:rect]; if(down) { [path fill]; -// colour=[NSColor whiteColor]; } else { [path stroke]; -// colour=[NSColor blackColor]; } - colour=[NSColor blackColor]; - bling=rect; - bling.origin.x-=1; - bling.origin.y-=1; - bling.size.width+=2; - bling.size.height+=2; - path=[NSBezierPath bezierPathWithOvalInRect:bling]; + bling.origin.x -= 1; + bling.origin.y -= 1; + bling.size.width +=2 ; + bling.size.height +=2 ; + path = [NSBezierPath bezierPathWithOvalInRect:bling]; [colour set]; [path stroke]; // Draw text - attributes=[NSDictionary dictionaryWithObject:colour forKey:NSForegroundColorAttributeName]; - size=[button sizeWithAttributes:attributes]; - point.x=rect.origin.x+((rect.size.width-size.width)/2); - point.y=rect.origin.y+((rect.size.height-size.height)/2); + attributes = @{NSForegroundColorAttributeName: colour}; + size = [button sizeWithAttributes:attributes]; + point.x = rect.origin.x + ((rect.size.width - size.width) / 2); + point.y = rect.origin.y + ((rect.size.height - size.height) / 2); [button drawAtPoint:point withAttributes:attributes]; } - (void)drawRect:(NSRect)rect { - NSRect area,bit; + NSRect area = [self bounds], bit; - area=[self bounds]; - bit.size.width=area.size.width/3; - bit.size.height=area.size.height/3; - bit.origin.x=area.origin.x+bit.size.width; - bit.origin.y=area.origin.y+(bit.size.height*2)-MINI_OFFSET; + bit.size.width = area.size.width / 3; + bit.size.height = area.size.height / 3; + bit.origin.x = area.origin.x + bit.size.width; + bit.origin.y = area.origin.y + (bit.size.height * 2) - MINI_OFFSET; [[NSColor yellowColor] set]; - [self drawButton:@"Y" inRectangle:bit pressed:y]; - bit.origin.y=area.origin.y+MINI_OFFSET; + [MyMainButtons drawButton:@"Y" inRectangle:bit pressed:y]; + bit.origin.y = area.origin.y + MINI_OFFSET; [[NSColor greenColor] set]; - [self drawButton:@"A" inRectangle:bit pressed:a]; - bit.origin.y=area.origin.y+bit.size.height; - bit.origin.x=area.origin.x+MINI_OFFSET; + [MyMainButtons drawButton:@"A" inRectangle:bit pressed:a]; + bit.origin.y = area.origin.y + bit.size.height; + bit.origin.x = area.origin.x + MINI_OFFSET; [[NSColor blueColor] set]; - [self drawButton:@"X" inRectangle:bit pressed:x]; - bit.origin.x=area.origin.x+(bit.size.width*2)-MINI_OFFSET; + [MyMainButtons drawButton:@"X" inRectangle:bit pressed:x]; + bit.origin.x = area.origin.x + (bit.size.width * 2) - MINI_OFFSET; [[NSColor redColor] set]; - [self drawButton:@"B" inRectangle:bit pressed:b]; -} - -- (void)setA:(BOOL)aVal -{ - a=aVal; - [self setNeedsDisplay:TRUE]; -} - -- (void)setB:(BOOL)bVal -{ - b=bVal; - [self setNeedsDisplay:TRUE]; -} - -- (void)setX:(BOOL)xVal -{ - x=xVal; - [self setNeedsDisplay:TRUE]; -} - -- (void)setY:(BOOL)yVal -{ - y=yVal; - [self setNeedsDisplay:TRUE]; + [MyMainButtons drawButton:@"B" inRectangle:bit pressed:b]; } @end diff --git a/Pref360Control/MyShoulderButton.h b/Pref360Control/MyShoulderButton.h index d4523d9..af17317 100644 --- a/Pref360Control/MyShoulderButton.h +++ b/Pref360Control/MyShoulderButton.h @@ -23,10 +23,5 @@ #import @interface MyShoulderButton : NSView -{ - BOOL pressed; -} - -- (void)setPressed:(BOOL)b; - +@property (nonatomic, getter = isPressed) BOOL pressed; @end diff --git a/Pref360Control/MyShoulderButton.m b/Pref360Control/MyShoulderButton.m index 829db27..d4f62c5 100644 --- a/Pref360Control/MyShoulderButton.m +++ b/Pref360Control/MyShoulderButton.m @@ -22,38 +22,30 @@ */ #import "MyShoulderButton.h" -#define INSET_AMOUNT 2 +#define INSET_AMOUNT 2 @implementation MyShoulderButton +@synthesize pressed; -- (id)initWithFrame:(NSRect)frameRect +- (void)setPressed:(BOOL)apressed { - if ((self = [super initWithFrame:frameRect]) != nil) { - pressed=FALSE; - } - return self; + pressed = apressed; + self.needsDisplay = YES; } - (void)drawRect:(NSRect)rect { - NSRect area; + NSRect area = [self bounds]; - area=[self bounds]; - NSDrawLightBezel(area,area); - if(pressed) { - area.origin.x+=INSET_AMOUNT; - area.origin.y+=INSET_AMOUNT; - area.size.width-=INSET_AMOUNT*2; - area.size.height-=INSET_AMOUNT*2; + NSDrawLightBezel(area, area); + if (pressed) { + area.origin.x += INSET_AMOUNT; + area.origin.y += INSET_AMOUNT; + area.size.width -= INSET_AMOUNT * 2; + area.size.height -= INSET_AMOUNT * 2; [[NSColor blueColor] set]; NSRectFill(area); } } -- (void)setPressed:(BOOL)b -{ - pressed=b; - [self setNeedsDisplay:TRUE]; -} - @end diff --git a/Pref360Control/MyTrigger.h b/Pref360Control/MyTrigger.h new file mode 100644 index 0000000..a8854bc --- /dev/null +++ b/Pref360Control/MyTrigger.h @@ -0,0 +1,15 @@ +// +// MyTrigger.h +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import + +@interface MyTrigger : NSView + +@property (nonatomic, strong) NSString *name; +@property (nonatomic) int val; + +@end diff --git a/Pref360Control/MyTrigger.m b/Pref360Control/MyTrigger.m new file mode 100644 index 0000000..def691f --- /dev/null +++ b/Pref360Control/MyTrigger.m @@ -0,0 +1,32 @@ +// +// MyTrigger.m +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import "MyTrigger.h" +#import "Pref360StyleKit.h" + +@implementation MyTrigger + + +- (void)setName:(NSString *)name { + _name = name; + [self setNeedsDisplay:YES]; +} + +- (void)setVal:(int)value { + _val = value; + [self setNeedsDisplay:YES]; +} + +- (void)drawRect:(NSRect)dirtyRect { + [super drawRect:dirtyRect]; + + if (_name == NULL) + _name = @""; + [Pref360StyleKit drawTriggerMetterWithIntensity:(_val / 255.0) triggerTitle:_name]; +} + +@end diff --git a/Pref360Control/MyWhole360Controller.h b/Pref360Control/MyWhole360Controller.h new file mode 100644 index 0000000..ac0c44c --- /dev/null +++ b/Pref360Control/MyWhole360Controller.h @@ -0,0 +1,45 @@ +// +// MyWhole360Controller.h +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import + +@interface MyWhole360Controller : NSView + +@property (nonatomic) BOOL aPressed; +@property (nonatomic) BOOL bPressed; +@property (nonatomic) BOOL xPressed; +@property (nonatomic) BOOL yPressed; + +@property (nonatomic) BOOL leftPressed; +@property (nonatomic) BOOL upPressed; +@property (nonatomic) BOOL rightPressed; +@property (nonatomic) BOOL downPressed; + +@property (nonatomic) BOOL backPressed; +@property (nonatomic) BOOL startPressed; +@property (nonatomic) BOOL homePressed; + +@property (nonatomic) BOOL lbPressed; +@property (nonatomic) BOOL rbPressed; +@property (nonatomic) BOOL leftStickPressed; +@property (nonatomic) BOOL rightStickPressed; + +@property (nonatomic) CGPoint leftStickPosition; +@property (nonatomic) CGPoint rightStickPosition; +@property (nonatomic) CGFloat leftStickDeadzone; +@property (nonatomic) CGFloat rightStickDeadzone; +@property (nonatomic) BOOL leftNormalized; +@property (nonatomic) BOOL rightNormalized; + +@property (nonatomic) int leftStickXPos; +@property (nonatomic) int leftStickYPos; +@property (nonatomic) int rightStickXPos; +@property (nonatomic) int rightStickYPos; + +- (void)reset; + +@end diff --git a/Pref360Control/MyWhole360Controller.m b/Pref360Control/MyWhole360Controller.m new file mode 100644 index 0000000..ee29bc4 --- /dev/null +++ b/Pref360Control/MyWhole360Controller.m @@ -0,0 +1,178 @@ +// +// MyWhole360Controller.m +// 360 Driver +// +// Created by Pierre TACCHI on 21/01/15. +// + +#import "MyWhole360Controller.h" +#import "Pref360StyleKit.h" + +@implementation MyWhole360Controller + + +- (void)setAPressed:(BOOL)pressed { + _aPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setBPressed:(BOOL)pressed { + _bPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setXPressed:(BOOL)pressed { + _xPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setYPressed:(BOOL)pressed { + _yPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setLeftPressed:(BOOL)pressed { + _leftPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setUpPressed:(BOOL)pressed { + _upPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setRightPressed:(BOOL)pressed { + _rightPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setDownPressed:(BOOL)pressed { + _downPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setBackPressed:(BOOL)pressed { + _backPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setStartPressed:(BOOL)pressed { + _startPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setHomePressed:(BOOL)pressed { + _homePressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setLbPressed:(BOOL)pressed { + _lbPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setRbPressed:(BOOL)pressed { + _rbPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setLeftStickPressed:(BOOL)pressed { + _leftStickPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setRightStickPressed:(BOOL)pressed { + _rightStickPressed = pressed; + [self setNeedsDisplay:YES]; +} + +- (void)setLeftStickPosition:(CGPoint)position { + _leftStickPosition = position; + [self setNeedsDisplay:YES]; +} + +- (void)setRightStickPosition:(CGPoint)position { + _rightStickPosition = position; + [self setNeedsDisplay:YES]; +} + +- (void)setLeftStickDeadzone:(CGFloat)deadzone { + _leftStickDeadzone = deadzone / 32768.0; + [self setNeedsDisplay:YES]; +} + +- (void)setRightStickDeadzone:(CGFloat)deadzone { + _rightStickDeadzone = deadzone / 32768.0; + [self setNeedsDisplay:YES]; +} + +- (void)setLeftNormalized:(BOOL)normalized { + _leftNormalized = normalized; + [self setNeedsDisplay:YES]; +} + +- (void)setRightNormalized:(BOOL)normalized { + _rightNormalized = normalized; + [self setNeedsDisplay:YES]; +} + +- (void)setLeftStickXPos:(int)xPos { + CGPoint p = _leftStickPosition; + p.x = xPos / 32768.0; + [self setLeftStickPosition:p]; +} + +- (void)setLeftStickYPos:(int)yPos { + CGPoint p = _leftStickPosition; + p.y = yPos / 32768.0; + [self setLeftStickPosition:p]; +} + +- (void)setRightStickXPos:(int)xPos { + CGPoint p = _rightStickPosition; + p.x = xPos / 32768.0; + [self setRightStickPosition:p]; +} + +- (void)setRightStickYPos:(int)yPos { + CGPoint p = _rightStickPosition; + p.y = yPos / 32768.0; + [self setRightStickPosition:p]; +} + +- (void)reset { + [self setAPressed:NO]; + [self setBPressed:NO]; + [self setXPressed:NO]; + [self setYPressed:NO]; + [self setLeftPressed:NO]; + [self setUpPressed:NO]; + [self setRightPressed:NO]; + [self setDownPressed:NO]; + [self setBackPressed:NO]; + [self setStartPressed:NO]; + [self setHomePressed:NO]; + [self setLbPressed:NO]; + [self setRbPressed:NO]; + [self setLeftStickPressed:NO]; + [self setRightStickPressed:NO]; + [self setLeftStickPosition:NSZeroPoint]; + [self setRightStickPosition:NSZeroPoint]; + [self setLeftStickDeadzone:0]; + [self setRightStickDeadzone:0]; + [self setLeftNormalized:NO]; + [self setRightNormalized:NO]; +} + +- (void)awakeFromNib { + _leftStickPosition = NSZeroPoint; + _rightStickPosition = NSZeroPoint; +} + +- (void)drawRect:(NSRect)dirtyRect { + [super drawRect:dirtyRect]; + + [Pref360StyleKit drawX360ControllerWithControllerNumber:0 aPressed:_aPressed bPressed:_bPressed xPressed:_xPressed yPressed:_yPressed leftPressed:_leftPressed upPressed:_upPressed rightPressed:_rightPressed downPressed:_downPressed backPressed:_backPressed startPressed:_startPressed lbPressed:_lbPressed rbPressed:_rbPressed homePressed:_homePressed leftStickPressed:_leftStickPressed rightStickPressed:_rightStickPressed leftStick:_leftStickPosition rightStick:_rightStickPosition leftStickDeadzone:_leftStickDeadzone rightStickDeadzone:_rightStickDeadzone isLeftNormalized:_leftNormalized isRightNormalized:_rightNormalized]; +} + +@end diff --git a/Pref360Control/MyWhole360ControllerMapper.h b/Pref360Control/MyWhole360ControllerMapper.h new file mode 100644 index 0000000..f144c23 --- /dev/null +++ b/Pref360Control/MyWhole360ControllerMapper.h @@ -0,0 +1,21 @@ +// +// MyWhole360ControllerMapper.h +// 360 Driver +// +// Created by Drew Mills on 1/30/15. +// Copyright (c) 2015 GitHub. All rights reserved. +// + +#import +#import "MyWhole360Controller.h" +#import "Pref360ControlPref.h" + +@interface MyWhole360ControllerMapper : MyWhole360Controller + +@property BOOL isMapping; + +- (void)runMapperWithButton:(NSButton *)button andOwner:(Pref360ControlPref *)pref; +- (void)buttonPressedAtIndex:(int)index; ++ (UInt8 *)mapping; + +@end \ No newline at end of file diff --git a/Pref360Control/MyWhole360ControllerMapper.m b/Pref360Control/MyWhole360ControllerMapper.m new file mode 100644 index 0000000..336a650 --- /dev/null +++ b/Pref360Control/MyWhole360ControllerMapper.m @@ -0,0 +1,176 @@ +// +// MyWhole360ControllerMapper.m +// 360 Driver +// +// Created by Drew Mills on 1/30/15. +// + +#import "MyWhole360Controller.h" +#import "MyWhole360ControllerMapper.h" +#import "Pref360StyleKit.h" +#import "BindingTableView.h" + +@implementation MyWhole360ControllerMapper +{ + int currentMappingIndex; + NSButton *remappingButton; + Pref360ControlPref *pref; +} + +static UInt8 mapping[15]; + ++ (UInt8 *)mapping +{ + return mapping; +} + +- (void)runMapperWithButton:(NSButton *)button andOwner:(Pref360ControlPref *)prefPref { + pref = prefPref; + remappingButton = button; +// [self resetMapping]; +// [pref changeSetting:nil]; + currentMappingIndex = 0; + _isMapping = YES; + [self setUpPressed:YES]; +} + +- (int)realignButtonToByte:(int)index { + if (index == 0) return 12; + if (index == 1) return 13; + if (index == 2) return 14; + if (index == 3) return 15; + if (index == 4) return 8; + if (index == 5) return 9; + if (index == 6) return 6; + if (index == 7) return 7; + if (index == 8) return 4; + if (index == 9) return 5; + if (index == 10) return 10; + if (index == 11) return 0; + if (index == 12) return 1; + if (index == 13) return 2; + if (index == 14) return 3; + return -1; // Should Never Happen +} + +- (void)buttonPressedAtIndex:(int)index { + mapping[currentMappingIndex] = [self realignButtonToByte:index]; + currentMappingIndex++; + [self setButtonAtIndex:currentMappingIndex]; + if (currentMappingIndex == 15) { + _isMapping = NO; + currentMappingIndex = 0; + [remappingButton setState:NSOffState]; + [[BindingTableView tableView] reloadData]; + [pref changeSetting:nil]; + } +} + +- (void)setButtonAtIndex:(int)index { + switch (index) { + case 1: + [self setUpPressed:NO]; + [self setDownPressed:YES]; + break; + + case 2: + [self setDownPressed:NO]; + [self setLeftPressed:YES]; + break; + + case 3: + [self setLeftPressed:NO]; + [self setRightPressed:YES]; + break; + + case 4: + [self setRightPressed:NO]; + [self setStartPressed:YES]; + break; + + case 5: + [self setStartPressed:NO]; + [self setBackPressed:YES]; + break; + + case 6: + [self setBackPressed:NO]; + [self setLeftStickPressed:YES]; + break; + + case 7: + [self setLeftStickPressed:NO]; + [self setRightStickPressed:YES]; + break; + + case 8: + [self setRightStickPressed:NO]; + [self setLbPressed:YES]; + break; + + case 9: + [self setLbPressed:NO]; + [self setRbPressed:YES]; + break; + + case 10: + [self setRbPressed:NO]; + [self setHomePressed:YES]; + break; + + case 11: + [self setHomePressed:NO]; + [self setAPressed:YES]; + break; + + case 12: + [self setAPressed:NO]; + [self setBPressed:YES]; + break; + + case 13: + [self setBPressed:NO]; + [self setXPressed:YES]; + break; + + case 14: + [self setXPressed:NO]; + [self setYPressed:YES]; + break; + + case 15: + [self setYPressed:NO]; + break; + + default: + break; + } +} + +- (void)resetMapping { + for (int i = 0; i < 15; i++) { + mapping[i] = i; + } + for (int i = 12; i < 16; i++) { + mapping[i-1] = i; + } +} + +- (void)reset { + [super reset]; + _isMapping = NO; + [self resetMapping]; + [remappingButton setState:NSOffState]; + [pref changeSetting:nil]; + [[BindingTableView tableView] reloadData]; +// [pref changeSetting:nil]; +} + +- (void)awakeFromNib { + [super awakeFromNib]; + _isMapping = NO; + [self resetMapping]; + [[BindingTableView tableView] reloadData]; +} + +@end \ No newline at end of file diff --git a/Pref360Control/Pref360Control.xcodeproj/project.pbxproj b/Pref360Control/Pref360Control.xcodeproj/project.pbxproj deleted file mode 100644 index f50d2a0..0000000 --- a/Pref360Control/Pref360Control.xcodeproj/project.pbxproj +++ /dev/null @@ -1,507 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 45; - objects = { - -/* Begin PBXBuildFile section */ - 3B04BE7313763D04005FA9F8 /* DeviceLister.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B04BE7113763D04005FA9F8 /* DeviceLister.h */; }; - 3B04BE7413763D04005FA9F8 /* DeviceLister.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B04BE7213763D04005FA9F8 /* DeviceLister.m */; }; - 3B04BEA61376416D005FA9F8 /* DriverTool in Resources */ = {isa = PBXBuildFile; fileRef = 3B04BEA51376416D005FA9F8 /* DriverTool */; }; - 3B47D9ED0B93C2BF00F200B8 /* battNone.tif in Resources */ = {isa = PBXBuildFile; fileRef = 3B47D9EC0B93C2BF00F200B8 /* battNone.tif */; }; - 3B47D9F20B93C31400F200B8 /* batt1.tif in Resources */ = {isa = PBXBuildFile; fileRef = 3B47D9EE0B93C31400F200B8 /* batt1.tif */; }; - 3B47D9F30B93C31400F200B8 /* batt0.tif in Resources */ = {isa = PBXBuildFile; fileRef = 3B47D9EF0B93C31400F200B8 /* batt0.tif */; }; - 3B47D9F40B93C31400F200B8 /* batt3.tif in Resources */ = {isa = PBXBuildFile; fileRef = 3B47D9F00B93C31400F200B8 /* batt3.tif */; }; - 3B47D9F50B93C31400F200B8 /* batt2.tif in Resources */ = {isa = PBXBuildFile; fileRef = 3B47D9F10B93C31400F200B8 /* batt2.tif */; }; - 3B86987F0CE2A22100283CEC /* ControlPrefs.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B86987D0CE2A22100283CEC /* ControlPrefs.h */; }; - 3B8698800CE2A22100283CEC /* ControlPrefs.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B86987E0CE2A22100283CEC /* ControlPrefs.m */; }; - 3B8B91321376FC120047D446 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B8B91311376FC120047D446 /* Security.framework */; }; - 3BBEAB01096B2C4C00F2E37B /* MyAnalogStick.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BBEAAFF096B2C4C00F2E37B /* MyAnalogStick.h */; }; - 3BBEAB02096B2C4C00F2E37B /* MyAnalogStick.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBEAB00096B2C4C00F2E37B /* MyAnalogStick.m */; }; - 3BBEAB05096B2C5200F2E37B /* MyCentreButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBEAB03096B2C5200F2E37B /* MyCentreButtons.m */; }; - 3BBEAB06096B2C5200F2E37B /* MyCentreButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BBEAB04096B2C5200F2E37B /* MyCentreButtons.h */; }; - 3BBEAB09096B2C5600F2E37B /* MyDigitalStick.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBEAB07096B2C5600F2E37B /* MyDigitalStick.m */; }; - 3BBEAB0A096B2C5600F2E37B /* MyDigitalStick.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BBEAB08096B2C5600F2E37B /* MyDigitalStick.h */; }; - 3BBEAB0D096B2C5B00F2E37B /* MyMainButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BBEAB0B096B2C5B00F2E37B /* MyMainButtons.h */; }; - 3BBEAB0E096B2C5B00F2E37B /* MyMainButtons.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBEAB0C096B2C5B00F2E37B /* MyMainButtons.m */; }; - 3BBEAB11096B2C6000F2E37B /* MyShoulderButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BBEAB0F096B2C6000F2E37B /* MyShoulderButton.h */; }; - 3BBEAB12096B2C6000F2E37B /* MyShoulderButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BBEAB10096B2C6000F2E37B /* MyShoulderButton.m */; }; - 3BBEAB2D096B6EDE00F2E37B /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BBEAB2C096B6EDE00F2E37B /* IOKit.framework */; }; - 3BC41F32096C85CB00664A42 /* DeviceItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BC41F30096C85CB00664A42 /* DeviceItem.h */; }; - 3BC41F33096C85CB00664A42 /* DeviceItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BC41F31096C85CB00664A42 /* DeviceItem.m */; }; - 3BC41F47096C8D0300664A42 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BC41F46096C8D0300664A42 /* ForceFeedback.framework */; }; - 8D202CEA0486D31800D8A456 /* Pref360Control_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = 32DBCFA20370C41700C91783 /* Pref360Control_Prefix.pch */; }; - 8D202CEB0486D31800D8A456 /* Pref360ControlPref.h in Headers */ = {isa = PBXBuildFile; fileRef = F506C03C013D9D7901CA16C8 /* Pref360ControlPref.h */; }; - 8D202CED0486D31800D8A456 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; - 8D202CEE0486D31800D8A456 /* Pref360ControlPref.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F506C040013D9D8001CA16C8 /* Pref360ControlPref.tiff */; }; - 8D202CEF0486D31800D8A456 /* Pref360ControlPref.nib in Resources */ = {isa = PBXBuildFile; fileRef = F506C042013D9D8C01CA16C8 /* Pref360ControlPref.nib */; }; - 8D202CF10486D31800D8A456 /* Pref360ControlPref.m in Sources */ = {isa = PBXBuildFile; fileRef = F506C03D013D9D7901CA16C8 /* Pref360ControlPref.m */; }; - 8D202CF30486D31800D8A456 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; - 8D202CF40486D31800D8A456 /* PreferencePanes.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F506C035013D953901CA16C8 /* PreferencePanes.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; - 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 32DBCFA20370C41700C91783 /* Pref360Control_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pref360Control_Prefix.pch; sourceTree = ""; }; - 3B04BE7113763D04005FA9F8 /* DeviceLister.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceLister.h; sourceTree = ""; }; - 3B04BE7213763D04005FA9F8 /* DeviceLister.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceLister.m; sourceTree = ""; }; - 3B04BEA51376416D005FA9F8 /* DriverTool */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.executable"; name = DriverTool; path = ../DriverTool/build/Release/DriverTool; sourceTree = SOURCE_ROOT; }; - 3B47D9EC0B93C2BF00F200B8 /* battNone.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = battNone.tif; sourceTree = ""; }; - 3B47D9EE0B93C31400F200B8 /* batt1.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = batt1.tif; sourceTree = ""; }; - 3B47D9EF0B93C31400F200B8 /* batt0.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = batt0.tif; sourceTree = ""; }; - 3B47D9F00B93C31400F200B8 /* batt3.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = batt3.tif; sourceTree = ""; }; - 3B47D9F10B93C31400F200B8 /* batt2.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = batt2.tif; sourceTree = ""; }; - 3B86987D0CE2A22100283CEC /* ControlPrefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ControlPrefs.h; path = ../360Daemon/ControlPrefs.h; sourceTree = SOURCE_ROOT; }; - 3B86987E0CE2A22100283CEC /* ControlPrefs.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ControlPrefs.m; path = ../360Daemon/ControlPrefs.m; sourceTree = SOURCE_ROOT; }; - 3B8B91311376FC120047D446 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; - 3BBEAAFF096B2C4C00F2E37B /* MyAnalogStick.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyAnalogStick.h; sourceTree = ""; }; - 3BBEAB00096B2C4C00F2E37B /* MyAnalogStick.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MyAnalogStick.m; sourceTree = ""; }; - 3BBEAB03096B2C5200F2E37B /* MyCentreButtons.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MyCentreButtons.m; sourceTree = ""; }; - 3BBEAB04096B2C5200F2E37B /* MyCentreButtons.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyCentreButtons.h; sourceTree = ""; }; - 3BBEAB07096B2C5600F2E37B /* MyDigitalStick.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MyDigitalStick.m; sourceTree = ""; }; - 3BBEAB08096B2C5600F2E37B /* MyDigitalStick.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyDigitalStick.h; sourceTree = ""; }; - 3BBEAB0B096B2C5B00F2E37B /* MyMainButtons.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyMainButtons.h; sourceTree = ""; }; - 3BBEAB0C096B2C5B00F2E37B /* MyMainButtons.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MyMainButtons.m; sourceTree = ""; }; - 3BBEAB0F096B2C6000F2E37B /* MyShoulderButton.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MyShoulderButton.h; sourceTree = ""; }; - 3BBEAB10096B2C6000F2E37B /* MyShoulderButton.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MyShoulderButton.m; sourceTree = ""; }; - 3BBEAB2C096B6EDE00F2E37B /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 3BC41F30096C85CB00664A42 /* DeviceItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceItem.h; sourceTree = ""; }; - 3BC41F31096C85CB00664A42 /* DeviceItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DeviceItem.m; sourceTree = ""; }; - 3BC41F46096C8D0300664A42 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 8D202CF70486D31800D8A456 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - 8D202CF80486D31800D8A456 /* Pref360Control.prefPane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Pref360Control.prefPane; sourceTree = BUILT_PRODUCTS_DIR; }; - F506C035013D953901CA16C8 /* PreferencePanes.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = PreferencePanes.framework; path = /System/Library/Frameworks/PreferencePanes.framework; sourceTree = ""; }; - F506C03C013D9D7901CA16C8 /* Pref360ControlPref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pref360ControlPref.h; sourceTree = ""; }; - F506C03D013D9D7901CA16C8 /* Pref360ControlPref.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Pref360ControlPref.m; sourceTree = ""; }; - F506C040013D9D8001CA16C8 /* Pref360ControlPref.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = Pref360ControlPref.tiff; sourceTree = ""; }; - F506C043013D9D8C01CA16C8 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Pref360ControlPref.nib; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D202CF20486D31800D8A456 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D202CF30486D31800D8A456 /* Cocoa.framework in Frameworks */, - 8D202CF40486D31800D8A456 /* PreferencePanes.framework in Frameworks */, - 3BBEAB2D096B6EDE00F2E37B /* IOKit.framework in Frameworks */, - 3BC41F47096C8D0300664A42 /* ForceFeedback.framework in Frameworks */, - 3B8B91321376FC120047D446 /* Security.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* Pref360Control */ = { - isa = PBXGroup; - children = ( - 08FB77AFFE84173DC02AAC07 /* Classes */, - 32DBCFA10370C40200C91783 /* Other Sources */, - 089C167CFE841241C02AAC07 /* Resources */, - 089C1671FE841209C02AAC07 /* Frameworks and Libraries */, - 19C28FB8FE9D52D311CA2CBB /* Products */, - ); - name = Pref360Control; - sourceTree = ""; - }; - 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, - 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, - ); - name = "Frameworks and Libraries"; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 3B04BEA51376416D005FA9F8 /* DriverTool */, - 8D202CF70486D31800D8A456 /* Info.plist */, - 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - F506C040013D9D8001CA16C8 /* Pref360ControlPref.tiff */, - F506C042013D9D8C01CA16C8 /* Pref360ControlPref.nib */, - 3B47D9EC0B93C2BF00F200B8 /* battNone.tif */, - 3B47D9EF0B93C31400F200B8 /* batt0.tif */, - 3B47D9EE0B93C31400F200B8 /* batt1.tif */, - 3B47D9F10B93C31400F200B8 /* batt2.tif */, - 3B47D9F00B93C31400F200B8 /* batt3.tif */, - ); - name = Resources; - sourceTree = ""; - }; - 08FB77AFFE84173DC02AAC07 /* Classes */ = { - isa = PBXGroup; - children = ( - 3B86987D0CE2A22100283CEC /* ControlPrefs.h */, - 3B86987E0CE2A22100283CEC /* ControlPrefs.m */, - F506C03C013D9D7901CA16C8 /* Pref360ControlPref.h */, - F506C03D013D9D7901CA16C8 /* Pref360ControlPref.m */, - 3BBEAAFF096B2C4C00F2E37B /* MyAnalogStick.h */, - 3BBEAB00096B2C4C00F2E37B /* MyAnalogStick.m */, - 3BBEAB04096B2C5200F2E37B /* MyCentreButtons.h */, - 3BBEAB03096B2C5200F2E37B /* MyCentreButtons.m */, - 3BBEAB08096B2C5600F2E37B /* MyDigitalStick.h */, - 3BBEAB07096B2C5600F2E37B /* MyDigitalStick.m */, - 3BBEAB0B096B2C5B00F2E37B /* MyMainButtons.h */, - 3BBEAB0C096B2C5B00F2E37B /* MyMainButtons.m */, - 3BBEAB0F096B2C6000F2E37B /* MyShoulderButton.h */, - 3BBEAB10096B2C6000F2E37B /* MyShoulderButton.m */, - 3BC41F30096C85CB00664A42 /* DeviceItem.h */, - 3BC41F31096C85CB00664A42 /* DeviceItem.m */, - 3B04BE7113763D04005FA9F8 /* DeviceLister.h */, - 3B04BE7213763D04005FA9F8 /* DeviceLister.m */, - ); - name = Classes; - sourceTree = ""; - }; - 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 3BC41F46096C8D0300664A42 /* ForceFeedback.framework */, - 3BBEAB2C096B6EDE00F2E37B /* IOKit.framework */, - 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, - F506C035013D953901CA16C8 /* PreferencePanes.framework */, - 3B8B91311376FC120047D446 /* Security.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 089C1672FE841209C02AAC07 /* Foundation.framework */, - 089C167FFE841241C02AAC07 /* AppKit.framework */, - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 19C28FB8FE9D52D311CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D202CF80486D31800D8A456 /* Pref360Control.prefPane */, - ); - name = Products; - sourceTree = ""; - }; - 32DBCFA10370C40200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCFA20370C41700C91783 /* Pref360Control_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8D202CE90486D31800D8A456 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D202CEA0486D31800D8A456 /* Pref360Control_Prefix.pch in Headers */, - 8D202CEB0486D31800D8A456 /* Pref360ControlPref.h in Headers */, - 3BBEAB01096B2C4C00F2E37B /* MyAnalogStick.h in Headers */, - 3BBEAB06096B2C5200F2E37B /* MyCentreButtons.h in Headers */, - 3BBEAB0A096B2C5600F2E37B /* MyDigitalStick.h in Headers */, - 3BBEAB0D096B2C5B00F2E37B /* MyMainButtons.h in Headers */, - 3BBEAB11096B2C6000F2E37B /* MyShoulderButton.h in Headers */, - 3BC41F32096C85CB00664A42 /* DeviceItem.h in Headers */, - 3B86987F0CE2A22100283CEC /* ControlPrefs.h in Headers */, - 3B04BE7313763D04005FA9F8 /* DeviceLister.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8D202CE80486D31800D8A456 /* Pref360Control */ = { - isa = PBXNativeTarget; - buildConfigurationList = 3BBDC6A5097946B50023AAD8 /* Build configuration list for PBXNativeTarget "Pref360Control" */; - buildPhases = ( - 8D202CE90486D31800D8A456 /* Headers */, - 8D202CEC0486D31800D8A456 /* Resources */, - 8D202CF00486D31800D8A456 /* Sources */, - 8D202CF20486D31800D8A456 /* Frameworks */, - 8D202CF50486D31800D8A456 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Pref360Control; - productInstallPath = "$(HOME)/Library/PreferencePanes"; - productName = Pref360Control; - productReference = 8D202CF80486D31800D8A456 /* Pref360Control.prefPane */; - productType = "com.apple.product-type.bundle"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 3BBDC6A9097946B50023AAD8 /* Build configuration list for PBXProject "Pref360Control" */; - compatibilityVersion = "Xcode 3.0"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 089C166AFE841209C02AAC07 /* Pref360Control */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8D202CE80486D31800D8A456 /* Pref360Control */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8D202CEC0486D31800D8A456 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D202CED0486D31800D8A456 /* InfoPlist.strings in Resources */, - 8D202CEE0486D31800D8A456 /* Pref360ControlPref.tiff in Resources */, - 8D202CEF0486D31800D8A456 /* Pref360ControlPref.nib in Resources */, - 3B47D9ED0B93C2BF00F200B8 /* battNone.tif in Resources */, - 3B47D9F20B93C31400F200B8 /* batt1.tif in Resources */, - 3B47D9F30B93C31400F200B8 /* batt0.tif in Resources */, - 3B47D9F40B93C31400F200B8 /* batt3.tif in Resources */, - 3B47D9F50B93C31400F200B8 /* batt2.tif in Resources */, - 3B04BEA61376416D005FA9F8 /* DriverTool in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 8D202CF50486D31800D8A456 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D202CF00486D31800D8A456 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D202CF10486D31800D8A456 /* Pref360ControlPref.m in Sources */, - 3BBEAB02096B2C4C00F2E37B /* MyAnalogStick.m in Sources */, - 3BBEAB05096B2C5200F2E37B /* MyCentreButtons.m in Sources */, - 3BBEAB09096B2C5600F2E37B /* MyDigitalStick.m in Sources */, - 3BBEAB0E096B2C5B00F2E37B /* MyMainButtons.m in Sources */, - 3BBEAB12096B2C6000F2E37B /* MyShoulderButton.m in Sources */, - 3BC41F33096C85CB00664A42 /* DeviceItem.m in Sources */, - 3B8698800CE2A22100283CEC /* ControlPrefs.m in Sources */, - 3B04BE7413763D04005FA9F8 /* DeviceLister.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; - F506C042013D9D8C01CA16C8 /* Pref360ControlPref.nib */ = { - isa = PBXVariantGroup; - children = ( - F506C043013D9D8C01CA16C8 /* English */, - ); - name = Pref360ControlPref.nib; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 3BBDC6A6097946B50023AAD8 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - COPY_PHASE_STRIP = NO; - DEBUGGING_SYMBOLS = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - "GCC_ENABLE_OBJC_GC[arch=x86_64]" = supported; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Pref360Control_Prefix.pch; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/PreferencePanes"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Bundle; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-bundle", - "-twolevel_namespace", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Pref360Control; - SDKROOT = ""; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = prefPane; - ZERO_LINK = YES; - }; - name = Development; - }; - 3BBDC6A7097946B50023AAD8 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - FRAMEWORK_SEARCH_PATHS = ""; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - "GCC_ENABLE_OBJC_GC[arch=x86_64]" = supported; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Pref360Control_Prefix.pch; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/PreferencePanes"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Bundle; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-bundle", - "-twolevel_namespace", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Pref360Control; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = prefPane; - ZERO_LINK = NO; - }; - name = Deployment; - }; - 3BBDC6A8097946B50023AAD8 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ""; - "GCC_ENABLE_OBJC_GC[arch=x86_64]" = supported; - GCC_ENABLE_TRIGRAPHS = NO; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Pref360Control_Prefix.pch; - GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO; - GCC_WARN_FOUR_CHARACTER_CONSTANTS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = NO; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(HOME)/Library/PreferencePanes"; - LIBRARY_SEARCH_PATHS = ""; - LIBRARY_STYLE = Bundle; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ( - "-bundle", - "-twolevel_namespace", - ); - OTHER_REZFLAGS = ""; - PRODUCT_NAME = Pref360Control; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = ( - "-Wmost", - "-Wno-four-char-constants", - "-Wno-unknown-pragmas", - ); - WRAPPER_EXTENSION = prefPane; - }; - name = Default; - }; - 3BBDC6AA097946B50023AAD8 /* Development */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Development; - }; - 3BBDC6AB097946B50023AAD8 /* Deployment */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Deployment; - }; - 3BBDC6AC097946B50023AAD8 /* Default */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Default; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 3BBDC6A5097946B50023AAD8 /* Build configuration list for PBXNativeTarget "Pref360Control" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3BBDC6A6097946B50023AAD8 /* Development */, - 3BBDC6A7097946B50023AAD8 /* Deployment */, - 3BBDC6A8097946B50023AAD8 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; - 3BBDC6A9097946B50023AAD8 /* Build configuration list for PBXProject "Pref360Control" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 3BBDC6AA097946B50023AAD8 /* Development */, - 3BBDC6AB097946B50023AAD8 /* Deployment */, - 3BBDC6AC097946B50023AAD8 /* Default */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Default; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/Pref360Control/Pref360ControlPref.h b/Pref360Control/Pref360ControlPref.h index 28f4b81..642807c 100644 --- a/Pref360Control/Pref360ControlPref.h +++ b/Pref360Control/Pref360ControlPref.h @@ -23,71 +23,90 @@ #import -#import -#import -#import -#import -#import - -#include "MyCentreButtons.h" -#include "MyDigitalStick.h" -#include "MyAnalogStick.h" -#include "MyMainButtons.h" -#include "MyShoulderButton.h" +#include +#include +#include +#include +#include +@class MyWhole360Controller; +@class MyWhole360ControllerMapper; +@class MyTrigger; +@class MyBatteryMonitor; +@class MyDeadZoneViewer; +@class MyAnalogStick; @class DeviceLister; -@interface Pref360ControlPref : NSPreferencePane -{ - // Window components - IBOutlet MyCentreButtons *centreButtons; - IBOutlet NSPopUpButton *deviceList; - IBOutlet MyDigitalStick *digiStick; - IBOutlet MyShoulderButton *leftShoulder; - IBOutlet MyAnalogStick *leftStick; - IBOutlet NSButton *leftLinked; - IBOutlet NSSlider *leftStickDeadzone; - IBOutlet NSButton *leftStickInvertX; - IBOutlet NSButton *leftStickInvertY; - IBOutlet NSProgressIndicator *leftTrigger; - IBOutlet MyMainButtons *rightButtons; - IBOutlet MyShoulderButton *rightShoulder; - IBOutlet MyAnalogStick *rightStick; - IBOutlet NSButton *rightLinked; - IBOutlet NSSlider *rightStickDeadzone; - IBOutlet NSButton *rightStickInvertX; - IBOutlet NSButton *rightStickInvertY; - IBOutlet NSProgressIndicator *rightTrigger; - IBOutlet NSImageView *batteryLevel; - IBOutlet DeviceLister *deviceLister; - IBOutlet NSButton *powerOff; - // Internal info - mach_port_t masterPort; - NSMutableArray *deviceArray; - IOHIDElementCookie axis[6],buttons[15]; - - IOHIDDeviceInterface122 **device; - IOHIDQueueInterface **hidQueue; - FFDeviceObjectReference ffDevice; - io_registry_entry_t registryEntry; - - int largeMotor,smallMotor; - - IONotificationPortRef notifyPort; - CFRunLoopSourceRef notifySource; - io_iterator_t onIteratorWired, offIteratorWired; - io_iterator_t onIteratorWireless, offIteratorWireless; -} +typedef NS_ENUM(NSUInteger, ControllerType) { + Xbox360Controller = 0, + XboxOriginalController = 1, + XboxOneController = 2 +} controllerType; + +@interface Pref360ControlPref : NSPreferencePane +// Window components +@property (weak) IBOutlet NSPopUpButton *deviceList; +@property (weak) IBOutlet NSButton *leftLinked; +@property (weak) IBOutlet NSSlider *leftStickDeadzone; +@property (weak) IBOutlet NSButton *leftStickInvertX; +@property (weak) IBOutlet NSButton *leftStickInvertY; +@property (weak) IBOutlet NSButton *rightLinked; +@property (weak) IBOutlet NSSlider *rightStickDeadzone; +@property (weak) IBOutlet NSButton *rightStickInvertX; +@property (weak) IBOutlet NSButton *rightStickInvertY; +@property (weak) IBOutlet DeviceLister *deviceLister; +@property (weak) IBOutlet NSButton *powerOff; +@property (weak) IBOutlet MyWhole360Controller *wholeController; +@property (weak) IBOutlet MyTrigger *leftTrigger; +@property (weak) IBOutlet MyTrigger *rightTrigger; +@property (weak) IBOutlet MyBatteryMonitor *batteryStatus; +@property (weak) IBOutlet MyDeadZoneViewer *leftDeadZone; +@property (weak) IBOutlet MyDeadZoneViewer *rightDeadZone; +@property (strong) IBOutlet NSPopover *aboutPopover; +@property (weak) IBOutlet NSPopUpButton *rumbleOptions; + +// Binding Tab +@property (weak) IBOutlet NSPopUpButton *deviceListBinding; +@property (weak) IBOutlet MyWhole360ControllerMapper *wholeControllerMapper; +@property (weak) IBOutlet NSTabView *tabView; +@property (weak) IBOutlet NSButton *remappingButton; +@property (weak) IBOutlet NSTableView *mappingTable; +@property (weak) IBOutlet NSButton *remappingResetButton; + +// Advanced Tab +@property (weak) IBOutlet NSPopUpButton *deviceListAdvanced; +// Advanced Tab - Options +@property (weak) IBOutlet NSButton *enableDriverCheckBox; +@property (weak) IBOutlet NSButton *uninstallDriverButton; +// Advanced Tab - Deadzones +@property (weak) IBOutlet MyAnalogStick *leftStickAnalog; +@property (weak) IBOutlet MyAnalogStick *rightStickAnalog; +@property (weak) IBOutlet NSButton *leftLinkedAlt; +@property (weak) IBOutlet NSSlider *leftStickDeadzoneAlt; +@property (weak) IBOutlet NSButton *leftStickInvertXAlt; +@property (weak) IBOutlet NSButton *leftStickInvertYAlt; +@property (weak) IBOutlet NSButton *rightLinkedAlt; +@property (weak) IBOutlet NSSlider *rightStickDeadzoneAlt; +@property (weak) IBOutlet NSButton *rightStickInvertXAlt; +@property (weak) IBOutlet NSButton *rightStickInvertYAlt; +@property (weak) IBOutlet NSButton *normalizeDeadzoneLeft; +@property (weak) IBOutlet NSButton *normalizeDeadzoneRight; + +// About Tab +/* put About Tab's @properties here */ -- (void)mainViewDidLoad; +// Internal info +@property (readonly) mach_port_t masterPort; - (void)eventQueueFired:(void*)sender withResult:(IOReturn)result; - (void)handleDeviceChange; -- (IBAction)showDeviceList:(id)sender; - (IBAction)powerOff:(id)sender; +- (IBAction)selectDevice:(id)sender; +- (IBAction)changeSetting:(id)sender; -- (mach_port_t)masterPort; +- (IBAction)toggleDriverEnabled:(NSButton *)sender; +- (IBAction)willPerformUninstallation:(id)sender; @end diff --git a/Pref360Control/Pref360ControlPref.m b/Pref360Control/Pref360ControlPref.m index 3f700a0..a9119f8 100644 --- a/Pref360Control/Pref360ControlPref.m +++ b/Pref360Control/Pref360ControlPref.m @@ -26,114 +26,190 @@ #import "DeviceItem.h" #import "ControlPrefs.h" #import "DeviceLister.h" +#import "MyWhole360Controller.h" +#import "MyWhole360ControllerMapper.h" +#import "MyTrigger.h" +#import "MyDeadZoneViewer.h" +#import "MyBatteryMonitor.h" +#import "MyAnalogStick.h" -#define NO_ITEMS @"No devices found" +#define NO_ITEMS @"No devices found" // Passes a C callback back to the Objective C class static void CallbackFunction(void *target,IOReturn result,void *refCon,void *sender) { - if(target!=NULL) [((Pref360ControlPref*)target) eventQueueFired:sender withResult:result]; + if (target) [((__bridge Pref360ControlPref*)target) eventQueueFired:sender withResult:result]; } // Handle callback for when our device is connected or disconnected. Both events are // actually handled identically. static void callbackHandleDevice(void *param,io_iterator_t iterator) { - io_service_t object=0; - BOOL update; + io_service_t object = 0; + BOOL update = NO; - update=FALSE; - while((object=IOIteratorNext(iterator))!=0) { + while ((object = IOIteratorNext(iterator))) { IOObjectRelease(object); - update=TRUE; + update = YES; } - if(update) [(Pref360ControlPref*)param handleDeviceChange]; + + if (update) [(__bridge Pref360ControlPref*)param handleDeviceChange]; } +@interface Pref360ControlPref () +@property (strong) NSMutableArray *deviceArray; +@end + @implementation Pref360ControlPref +{ +@private + // Internal info + IOHIDElementCookie axis[6],buttons[15]; + + IOHIDDeviceInterface122 **device; + IOHIDQueueInterface **hidQueue; + FFDeviceObjectReference ffDevice; + io_registry_entry_t registryEntry; + + int largeMotor, smallMotor; + + IONotificationPortRef notifyPort; + CFRunLoopSourceRef notifySource; + io_iterator_t onIteratorWired, offIteratorWired; + io_iterator_t onIteratorWireless, offIteratorWireless; + + FFEFFECT *effect; + FFCUSTOMFORCE *customforce; + FFEffectObjectReference effectRef; +} + + +-(void)awakeFromNib { + [_aboutPopover setAppearance:NSPopoverAppearanceHUD]; + [_rumbleOptions removeAllItems]; + [_rumbleOptions addItemsWithTitles:@[@"Default", @"None"]]; + if (controllerType == XboxOneController) + [_rumbleOptions addItemsWithTitles:@[@"Triggers Only", @"Both"]]; +} // Set the pattern on the LEDs - (void)updateLED:(int)ledIndex { - FFEFFESCAPE escape; - unsigned char c; + FFEFFESCAPE escape = {0}; + unsigned char c = ledIndex; - if(ffDevice==0) return; - c=ledIndex; - escape.dwSize=sizeof(escape); - escape.dwCommand=0x02; - escape.cbInBuffer=sizeof(c); - escape.lpvInBuffer=&c; - escape.cbOutBuffer=0; - escape.lpvOutBuffer=NULL; - FFDeviceEscape(ffDevice,&escape); + if (ffDevice == 0) return; + escape.dwSize = sizeof(escape); + escape.dwCommand = 0x02; + escape.cbInBuffer = sizeof(c); + escape.lpvInBuffer = &c; + FFDeviceEscape(ffDevice, &escape); } -// Enables and disables the rumble motor "override" -- (void)setMotorOverride:(BOOL)enable +// This will initialize the ff effect. +- (void)testMotorsInit { - FFEFFESCAPE escape; - char c; - - if(ffDevice==0) return; - // If true, the motors will no longer obey any Force Feedback Framework - // effects, and the motors may be controlled directly. False and the - // motors will perform effects but can not be directly controlled. - c=enable?0x01:0x00; - escape.dwSize=sizeof(escape); - escape.dwCommand=0x00; - escape.cbInBuffer=sizeof(c); - escape.lpvInBuffer=&c; - escape.cbOutBuffer=0; - escape.lpvOutBuffer=NULL; - FFDeviceEscape(ffDevice,&escape); + if (ffDevice == 0) return; + + FFCAPABILITIES capabs; + FFDeviceGetForceFeedbackCapabilities(ffDevice, &capabs); + + if(capabs.numFfAxes != 2) return; + + effect = calloc(1, sizeof(FFEFFECT)); + customforce = calloc(1, sizeof(FFCUSTOMFORCE)); + LONG *c = calloc(2, sizeof(LONG)); + DWORD *a = calloc(2, sizeof(DWORD)); + LONG *d = calloc(2, sizeof(LONG)); + + c[0] = 0; + c[1] = 0; + a[0] = capabs.ffAxes[0]; + a[1] = capabs.ffAxes[1]; + d[0] = 0; + d[1] = 0; + + customforce->cChannels = 2; + customforce->cSamples = 2; + customforce->rglForceData = c; + customforce->dwSamplePeriod = 100*1000; + + effect->cAxes = capabs.numFfAxes; + effect->rglDirection = d; + effect->rgdwAxes = a; + effect->dwSamplePeriod = 0; + effect->dwGain = 10000; + effect->dwFlags = FFEFF_OBJECTOFFSETS | FFEFF_SPHERICAL; + effect->dwSize = sizeof(FFEFFECT); + effect->dwDuration = FF_INFINITE; + effect->dwSamplePeriod = 100*1000; + effect->cbTypeSpecificParams = sizeof(FFCUSTOMFORCE); + effect->lpvTypeSpecificParams = customforce; + effect->lpEnvelope = NULL; + FFDeviceCreateEffect(ffDevice, kFFEffectType_CustomForce_ID, effect, &effectRef); } -// If the direct rumble control is enabled, this will set the motors -// to the desired speed. +- (void)testMotorsCleanUp +{ + if (effectRef == NULL) return; + FFDeviceReleaseEffect(ffDevice, effectRef); + free(customforce->rglForceData); + free(effect->rgdwAxes); + free(effect->rglDirection); + free(customforce); + free(effect); +} - (void)testMotorsLarge:(unsigned char)large small:(unsigned char)small { - FFEFFESCAPE escape; - char c[2]; - - if(ffDevice==0) return; - c[0]=large; - c[1]=small; - escape.dwSize=sizeof(escape); - escape.dwCommand=0x01; - escape.cbInBuffer=sizeof(c); - escape.lpvInBuffer=c; - escape.cbOutBuffer=0; - escape.lpvOutBuffer=NULL; - FFDeviceEscape(ffDevice,&escape); + if (effectRef == NULL) return; + customforce->rglForceData[0] = (large * 10000) / 255; + customforce->rglForceData[1] = (small * 10000) / 255; + FFEffectSetParameters(effectRef, effect, FFEP_TYPESPECIFICPARAMS); + FFEffectStart(effectRef, 1, 0); } // Update axis GUI component - (void)axisChanged:(int)index newValue:(int)value { + NSInteger tabIndex = [_tabView indexOfTabViewItem:[_tabView selectedTabViewItem]]; + switch(index) { case 0: - [leftStick setPositionX:value]; + [_wholeController setLeftStickXPos:value]; + [_leftStickAnalog setPositionX:value]; break; + case 1: - [leftStick setPositionY:value]; + [_wholeController setLeftStickYPos:value]; + [_leftStickAnalog setPositionY:value]; break; + case 2: - [rightStick setPositionX:value]; + [_wholeController setRightStickXPos:value]; + [_rightStickAnalog setPositionX:value]; break; + case 3: - [rightStick setPositionY:value]; + [_wholeController setRightStickYPos:value]; + [_rightStickAnalog setPositionY:value]; break; + case 4: - [leftTrigger setDoubleValue:value]; - largeMotor=value; -// [self testMotorsLarge:largeMotor small:smallMotor]; + if (tabIndex == 0) { // Controller Test + [_leftTrigger setVal:value]; + largeMotor=value; + [self testMotorsLarge:largeMotor small:smallMotor]; + } break; + case 5: - [rightTrigger setDoubleValue:value]; - smallMotor=value; -// [self testMotorsLarge:largeMotor small:smallMotor]; + if (tabIndex == 0) { + [_rightTrigger setVal:value]; + smallMotor=value; + [self testMotorsLarge:largeMotor small:smallMotor]; + } break; + default: break; } @@ -142,85 +218,109 @@ - (void)axisChanged:(int)index newValue:(int)value // Update button GUI component - (void)buttonChanged:(int)index newValue:(int)value { - BOOL b; + BOOL b = (value != 0); + NSInteger tabIndex = [_tabView indexOfTabViewItem:[_tabView selectedTabViewItem]]; - b=value!=0; - switch(index) { - case 0: - [rightButtons setA:b]; - break; - case 1: - [rightButtons setB:b]; - break; - case 2: - [rightButtons setX:b]; - break; - case 3: - [rightButtons setY:b]; - break; - case 4: - [leftShoulder setPressed:b]; - break; - case 5: - [rightShoulder setPressed:b]; - break; - case 6: - [leftStick setPressed:b]; - break; - case 7: - [rightStick setPressed:b]; - break; - case 8: - [centreButtons setStart:b]; - break; - case 9: - [centreButtons setBack:b]; - break; - case 10: - [centreButtons setSpecific:b]; - break; - case 11: - [digiStick setUp:b]; - break; - case 12: - [digiStick setDown:b]; - break; - case 13: - [digiStick setLeft:b]; - break; - case 14: - [digiStick setRight:b]; - break; - default: - break; + if (tabIndex == 0) { // Controller Test + switch (index) { + case 0: + [_wholeController setAPressed:b]; + break; + + case 1: + [_wholeController setBPressed:b]; + break; + + case 2: + [_wholeController setXPressed:b]; + break; + + case 3: + [_wholeController setYPressed:b]; + break; + + case 4: + [_wholeController setLbPressed:b]; + break; + + case 5: + [_wholeController setRbPressed:b]; + break; + + case 6: + [_wholeController setLeftStickPressed:b]; + break; + + case 7: + [_wholeController setRightStickPressed:b]; + break; + + case 8: + [_wholeController setStartPressed:b]; + break; + + case 9: + [_wholeController setBackPressed:b]; + break; + + case 10: + [_wholeController setHomePressed:b]; + break; + + case 11: + [_wholeController setUpPressed:b]; + break; + + case 12: + [_wholeController setDownPressed:b]; + break; + + case 13: + [_wholeController setLeftPressed:b]; + break; + + case 14: + [_wholeController setRightPressed:b]; + break; + + default: + break; + } + } + else if (tabIndex == 1) { // Tweaks + if ([_wholeControllerMapper isMapping]) { + if (b == YES) { + [_wholeControllerMapper buttonPressedAtIndex:index]; + } + } } } // Handle message from I/O Kit indicating something happened on the device - (void)eventQueueFired:(void*)sender withResult:(IOReturn)result { - AbsoluteTime zeroTime={0,0}; + AbsoluteTime zeroTime = {0,0}; IOHIDEventStruct event; - BOOL found; + BOOL found = NO; int i; - if(sender!=hidQueue) return; - while(result==kIOReturnSuccess) { - result=(*hidQueue)->getNextEvent(hidQueue,&event,zeroTime,0); - if(result!=kIOReturnSuccess) continue; + if (sender != hidQueue) return; + while (result == kIOReturnSuccess) { + result = (*hidQueue)->getNextEvent(hidQueue,&event,zeroTime,0); + if (result != kIOReturnSuccess) continue; // Check axis - for(i=0,found=FALSE;(i<6)&&(!found);i++) { - if(event.elementCookie==axis[i]) { + for (i = 0, found = NO; (i < 6) && !found; i++) { + if (event.elementCookie == axis[i]) { [self axisChanged:i newValue:event.value]; - found=TRUE; + found = YES; } } - if(found) continue; + if (found) continue; // Check buttons - for(i=0,found=FALSE;(i<15)&&(!found);i++) { + for (i = 0, found = NO; (i < 15) && !found; i++) { if(event.elementCookie==buttons[i]) { [self buttonChanged:i newValue:event.value]; - found=TRUE; + found = YES; } } if(found) continue; @@ -231,65 +331,68 @@ - (void)eventQueueFired:(void*)sender withResult:(IOReturn)result // Enable input components - (void)inputEnable:(BOOL)enable { - [leftStickDeadzone setEnabled:enable]; - [leftStickInvertX setEnabled:enable]; - [leftStickInvertY setEnabled:enable]; - [leftLinked setEnabled:enable]; - [rightStickDeadzone setEnabled:enable]; - [rightStickInvertX setEnabled:enable]; - [rightStickInvertY setEnabled:enable]; - [rightLinked setEnabled:enable]; + [_leftStickDeadzone setEnabled:enable]; + [_leftStickDeadzoneAlt setEnabled:enable]; + [_leftStickInvertX setEnabled:enable]; + [_leftStickInvertXAlt setEnabled:enable]; + [_leftStickInvertY setEnabled:enable]; + [_leftStickInvertYAlt setEnabled:enable]; + [_leftLinked setEnabled:enable]; + [_leftLinkedAlt setEnabled:enable]; + [_rightStickDeadzone setEnabled:enable]; + [_rightStickDeadzoneAlt setEnabled:enable]; + [_rightStickInvertX setEnabled:enable]; + [_rightStickInvertXAlt setEnabled:enable]; + [_rightStickInvertY setEnabled:enable]; + [_rightStickInvertYAlt setEnabled:enable]; + [_rightLinked setEnabled:enable]; + [_rightLinkedAlt setEnabled:enable]; + [_normalizeDeadzoneLeft setEnabled:enable]; + [_normalizeDeadzoneRight setEnabled:enable]; + [_rumbleOptions setEnabled:enable]; } // Reset GUI components - (void)resetDisplay { - NSBundle *bundle; - - [leftStick setPositionX:0 y:0]; - [leftStick setPressed:FALSE]; - [leftStick setDeadzone:0]; - [digiStick setUp:FALSE]; - [digiStick setDown:FALSE]; - [digiStick setLeft:FALSE]; - [digiStick setRight:FALSE]; - [centreButtons setBack:FALSE]; - [centreButtons setSpecific:FALSE]; - [centreButtons setStart:FALSE]; - [rightStick setPositionX:0 y:0]; - [rightStick setPressed:FALSE]; - [rightStick setDeadzone:0]; - [rightButtons setA:FALSE]; - [rightButtons setB:FALSE]; - [rightButtons setX:FALSE]; - [rightButtons setY:FALSE]; - [leftShoulder setPressed:FALSE]; - [leftTrigger setDoubleValue:0]; - [rightShoulder setPressed:FALSE]; - [rightTrigger setDoubleValue:0]; + [_leftTrigger setVal:0]; + [_rightTrigger setVal:0]; + [_wholeController reset]; + [_leftDeadZone setVal:0]; + [_leftStickAnalog setDeadzone:0]; + [_leftDeadZone setLinked:NO]; + [_leftStickAnalog setLinked:NO]; + [_rightDeadZone setVal:0]; + [_rightStickAnalog setDeadzone:0]; + [_rightDeadZone setLinked:NO]; + [_rightStickAnalog setLinked:NO]; // Reset inputs - [leftStickDeadzone setIntValue:0]; - [leftStickInvertX setState:NSOffState]; - [leftStickInvertY setState:NSOffState]; - [rightStickDeadzone setIntValue:0]; - [rightStickInvertX setState:NSOffState]; - [rightStickInvertY setState:NSOffState]; + [_leftStickDeadzone setIntValue:0]; + [_leftStickDeadzoneAlt setIntValue:0]; + [_leftStickInvertX setState:NSOffState]; + [_leftStickInvertXAlt setState:NSOffState]; + [_leftStickInvertY setState:NSOffState]; + [_leftStickInvertYAlt setState:NSOffState]; + [_rightStickDeadzone setIntValue:0]; + [_rightStickDeadzoneAlt setIntValue:0]; + [_rightStickInvertX setState:NSOffState]; + [_rightStickInvertXAlt setState:NSOffState]; + [_rightStickInvertY setState:NSOffState]; + [_rightStickInvertYAlt setState:NSOffState]; // Disable inputs [self inputEnable:NO]; - [powerOff setHidden:YES]; - // Hide battery icon - bundle = [NSBundle bundleForClass:[self class]]; - [batteryLevel setImage:[[[NSImage alloc] initByReferencingFile:[bundle pathForResource:@"battNone" ofType:@"tif"]] autorelease]]; + [_powerOff setHidden:YES]; + // Hide battery status + [_batteryStatus setHidden:YES]; } // Stop using the HID device - (void)stopDevice { if(registryEntry==0) return; -// [self testMotorsLarge:0 small:0]; -// [self setMotorOverride:FALSE]; -// [self updateLED:0x00]; - if(hidQueue!=NULL) { + [self testMotorsLarge:0 small:0]; + [self testMotorsCleanUp]; + if (hidQueue) { CFRunLoopSourceRef eventSource; (*hidQueue)->stop(hidQueue); @@ -297,63 +400,67 @@ - (void)stopDevice if((eventSource!=NULL)&&CFRunLoopContainsSource(CFRunLoopGetCurrent(),eventSource,kCFRunLoopCommonModes)) CFRunLoopRemoveSource(CFRunLoopGetCurrent(),eventSource,kCFRunLoopCommonModes); (*hidQueue)->Release(hidQueue); - hidQueue=NULL; + hidQueue = NULL; } - if(device!=NULL) { + if (device) { (*device)->close(device); - device=NULL; + device = NULL; } - registryEntry=0; + registryEntry = 0; } // Start using a HID device - (void)startDevice { - int i,j; - CFArrayRef elements; - CFDictionaryRef element; - CFTypeRef object; - long number; + int i = (int)[_deviceList indexOfSelectedItem]; + int j; + CFArrayRef CFelements; IOHIDElementCookie cookie; long usage,usagePage; CFRunLoopSourceRef eventSource; IOReturn ret; [self resetDisplay]; - i=(int)[deviceList indexOfSelectedItem]; - if(([deviceArray count]==0)||(i==-1)) { - NSLog(@"No devices found? :( device count==%i, i==%i",(int)[deviceArray count],i); + if(([_deviceArray count]==0)||(i==-1)) { + NSLog(@"No devices found? :( device count==%i, i==%i",(int)[_deviceArray count], i); return; } { - DeviceItem *item=[deviceArray objectAtIndex:i]; + DeviceItem *item = _deviceArray[i]; - device=[item hidDevice]; - ffDevice=[item ffDevice]; - registryEntry=[item rawDevice]; + device = [item hidDevice]; + ffDevice = [item ffDevice]; + registryEntry = [item rawDevice]; } - if((*device)->copyMatchingElements(device,NULL,&elements)!=kIOReturnSuccess) { + + if((*device)->copyMatchingElements(device,NULL,&CFelements)!=kIOReturnSuccess) { NSLog(@"Can't get elements list"); // Make note of failure? return; } - for(i=0;icreateAsyncEventSource(hidQueue,&eventSource); + ret=(*hidQueue)->createAsyncEventSource(hidQueue, &eventSource); if(ret!=kIOReturnSuccess) { NSLog(@"Unable to create async event source"); // Error? return; } // Set callback - ret=(*hidQueue)->setEventCallout(hidQueue,CallbackFunction,self,NULL); + ret=(*hidQueue)->setEventCallout(hidQueue, CallbackFunction, (__bridge void *)(self), NULL); if(ret!=kIOReturnSuccess) { NSLog(@"Unable to set event callback"); // Error? return; } // Add to runloop - CFRunLoopAddSource(CFRunLoopGetCurrent(),eventSource,kCFRunLoopCommonModes); + CFRunLoopAddSource(CFRunLoopGetCurrent(), eventSource, kCFRunLoopCommonModes); // Add some elements - for(i=0;i<6;i++) - (*hidQueue)->addElement(hidQueue,axis[i],0); - for(i=0;i<15;i++) - (*hidQueue)->addElement(hidQueue,buttons[i],0); + for (i = 0; i < 6; i++) + (*hidQueue)->addElement(hidQueue, axis[i], 0); + for (i = 0; i < 15; i++) + (*hidQueue)->addElement(hidQueue, buttons[i], 0); // Start - ret=(*hidQueue)->start(hidQueue); - if(ret!=kIOReturnSuccess) { - NSLog(@"Unable to start queue - 0x%.8x",ret); + ret = (*hidQueue)->start(hidQueue); + if (ret != kIOReturnSuccess) { + NSLog(@"Unable to start queue - 0x%.8x", ret); // Error? return; } // Read existing properties { -// CFDictionaryRef dict=(CFDictionaryRef)IORegistryEntryCreateCFProperty(registryEntry,CFSTR("DeviceData"),NULL,0); - CFDictionaryRef dict = (CFDictionaryRef)[GetController(GetSerialNumber(registryEntry)) retain]; - if(dict!=0) { + // CFDictionaryRef dict=(CFDictionaryRef)IORegistryEntryCreateCFProperty(registryEntry,CFSTR("DeviceData"),NULL,0); + CFDictionaryRef dict = (CFDictionaryRef)CFBridgingRetain(GetController(GetSerialNumber(registryEntry))); + if(dict) { CFBooleanRef boolValue; CFNumberRef intValue; if(CFDictionaryGetValueIfPresent(dict,CFSTR("InvertLeftX"),(void*)&boolValue)) { - [leftStickInvertX setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; - } else NSLog(@"No value for InvertLeftX"); + [_leftStickInvertX setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + [_leftStickInvertXAlt setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + } else NSLog(@"No value for InvertLeftX\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("InvertLeftY"),(void*)&boolValue)) { - [leftStickInvertY setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; - } else NSLog(@"No value for InvertLeftY"); + [_leftStickInvertY setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + [_leftStickInvertYAlt setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + } else NSLog(@"No value for InvertLeftY\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("RelativeLeft"),(void*)&boolValue)) { BOOL enable=CFBooleanGetValue(boolValue); - [leftLinked setState:enable?NSOnState:NSOffState]; - [leftStick setLinked:enable]; - } else NSLog(@"No value for RelativeLeft"); + [_leftLinked setState:enable?NSOnState:NSOffState]; + [_leftLinkedAlt setState:enable?NSOnState:NSOffState]; + [_leftDeadZone setLinked:enable]; + [_leftStickAnalog setLinked:enable]; + } else NSLog(@"No value for RelativeLeft\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("DeadzoneLeft"),(void*)&intValue)) { UInt16 i; CFNumberGetValue(intValue,kCFNumberShortType,&i); - [leftStickDeadzone setIntValue:i]; - [leftStick setDeadzone:i]; - } else NSLog(@"No value for DeadzoneLeft"); + [_leftStickDeadzone setIntValue:i]; + [_leftStickDeadzoneAlt setIntValue:i]; + [_leftDeadZone setVal:i]; + [_wholeController setLeftStickDeadzone:i]; + [_leftStickAnalog setDeadzone:i]; + } else NSLog(@"No value for DeadzoneLeft\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("InvertRightX"),(void*)&boolValue)) { - [rightStickInvertX setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; - } else NSLog(@"No value for InvertRightX"); + [_rightStickInvertX setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + [_rightStickInvertXAlt setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + } else NSLog(@"No value for InvertRightX\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("InvertRightY"),(void*)&boolValue)) { - [rightStickInvertY setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; - } else NSLog(@"No value for InvertRightY"); + [_rightStickInvertY setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + [_rightStickInvertYAlt setState:CFBooleanGetValue(boolValue)?NSOnState:NSOffState]; + } else NSLog(@"No value for InvertRightY\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("RelativeRight"),(void*)&boolValue)) { BOOL enable=CFBooleanGetValue(boolValue); - [rightLinked setState:enable?NSOnState:NSOffState]; - [rightStick setLinked:enable]; - } else NSLog(@"No value for RelativeRight"); + [_rightLinked setState:enable?NSOnState:NSOffState]; + [_rightLinkedAlt setState:enable?NSOnState:NSOffState]; + [_rightDeadZone setLinked:enable]; + [_wholeController setRightStickDeadzone:i]; + [_rightStickAnalog setLinked:enable]; + } else NSLog(@"No value for RelativeRight\n"); if(CFDictionaryGetValueIfPresent(dict,CFSTR("DeadzoneRight"),(void*)&intValue)) { UInt16 i; CFNumberGetValue(intValue,kCFNumberShortType,&i); - [rightStickDeadzone setIntValue:i]; - [rightStick setDeadzone:i]; - } else NSLog(@"No value for DeadzoneRight"); - CFRelease(dict); - } else NSLog(@"No settings found"); + [_rightStickDeadzone setIntValue:i]; + [_rightStickDeadzoneAlt setIntValue:i]; + [_rightDeadZone setVal:i]; + [_rightStickAnalog setDeadzone:i]; + } else NSLog(@"No value for DeadzoneRight\n"); + + if(CFDictionaryGetValueIfPresent(dict,CFSTR("ControllerType"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + controllerType = (ControllerType)[num integerValue]; + } else NSLog(@"No value for ControllerType\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("RumbleType"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [_rumbleOptions setState:[num integerValue]]; + } else NSLog(@"No value for RumbleType\n"); + + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingUp"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][0] = [num intValue]; + } else NSLog(@"No value for BindingUp\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingDown"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][1] = [num intValue]; + } else NSLog(@"No value for BindingDown\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingLeft"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][2] = [num intValue]; + } else NSLog(@"No value for BindingLeft\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingRight"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][3] = [num intValue]; + } else NSLog(@"No value for BindingRight\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingStart"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][4] = [num intValue]; + } else NSLog(@"No value for BindingStart\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingBack"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][5] = [num intValue]; + } else NSLog(@"No value for BindingBack\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingLSC"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][6] = [num intValue]; + } else NSLog(@"No value for BindingLSC\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingRSC"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][7] = [num intValue]; + } else NSLog(@"No value for BindingRSC\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingLB"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][8] = [num intValue]; + } else NSLog(@"No value for BindingLB\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingRB"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][9] = [num intValue]; + } else NSLog(@"No value for BindingRB\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingGuide"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][10] = [num intValue]; + } else NSLog(@"No value for BindingGuide\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingA"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][11] = [num intValue]; + } else NSLog(@"No value for BindingA\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingB"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][12] = [num intValue]; + } else NSLog(@"No value for BindingB\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingX"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][13] = [num intValue]; + } else NSLog(@"No value for BindingX\n"); + if(CFDictionaryGetValueIfPresent(dict,CFSTR("BindingY"),(void*)&intValue)) { + NSNumber *num = (__bridge NSNumber *)intValue; + [MyWhole360ControllerMapper mapping][14] = [num intValue]; + } else NSLog(@"No value for BindingY\n"); + } else NSLog(@"No settings found\n"); } // Enable GUI components [self inputEnable:YES]; - // Set LED and manual motor control -// [self updateLED:0x0a]; -// [self setMotorOverride:TRUE]; -// [self testMotorsLarge:0 small:0]; - largeMotor=0; - smallMotor=0; + // Set device capabilities + // Set FF motor control + [self testMotorsInit]; + [self testMotorsLarge:0 small:0]; + largeMotor = 0; + smallMotor = 0; // Battery level? { - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSString *path; + int batteryLevel = -1; CFTypeRef prop; - path = nil; - if (IOObjectConformsTo(registryEntry, "WirelessHIDDevice")) - { + if (IOObjectConformsTo(registryEntry, "WirelessHIDDevice")) { prop = IORegistryEntryCreateCFProperty(registryEntry, CFSTR("BatteryLevel"), NULL, 0); - if (prop != nil) - { + if (prop != nil) { unsigned char level; if (CFNumberGetValue(prop, kCFNumberCharType, &level)) - path = [bundle pathForResource:[NSString stringWithFormat:@"batt%i", level / 64] ofType:@"tif"]; + batteryLevel = level / 64; CFRelease(prop); } - [powerOff setHidden:NO]; + [_powerOff setHidden:NO]; + } + if ( batteryLevel >= 0) { + [_batteryStatus setBars:batteryLevel]; + [_batteryStatus setHidden:NO]; + } else { + [_batteryStatus setHidden:YES]; } - if (path == nil) - path = [bundle pathForResource:@"battNone" ofType:@"tif"]; - [batteryLevel setImage:[[[NSImage alloc] initByReferencingFile:path] autorelease]]; } + + [_mappingTable reloadData]; + + // Allows the kext to be disabled when you connect a controller once + // FIXME: Allow disabling the driver at any time. + [self.enableDriverCheckBox setEnabled:YES]; } // Clear out the device lists - (void)deleteDeviceList { - [deviceList removeAllItems]; - [deviceArray removeAllObjects]; + [_deviceList removeAllItems]; + [_deviceListBinding removeAllItems]; + [_deviceListAdvanced removeAllItems]; + [_deviceArray removeAllObjects]; } // Update the device list from the I/O Kit @@ -526,23 +723,24 @@ - (void)updateDeviceList CFMutableDictionaryRef hidDictionary; IOReturn ioReturn; io_iterator_t iterator; - io_object_t hidDevice, parent; - int count; - DeviceItem *item; + io_object_t hidDevice; + int count = 0; // Scrub old items [self stopDevice]; [self deleteDeviceList]; // Add new items hidDictionary=IOServiceMatching(kIOHIDDeviceKey); - ioReturn=IOServiceGetMatchingServices(masterPort,hidDictionary,&iterator); - if((ioReturn!=kIOReturnSuccess)||(iterator==0)) { - [deviceList addItemWithTitle:NO_ITEMS]; + ioReturn=IOServiceGetMatchingServices(_masterPort,hidDictionary,&iterator); + if((ioReturn != kIOReturnSuccess) || (iterator == 0)) { + [_deviceList addItemWithTitle:NO_ITEMS]; + [_deviceListBinding addItemWithTitle:NO_ITEMS]; + [_deviceListAdvanced addItemWithTitle:NO_ITEMS]; return; } - count=0; - while((hidDevice=IOIteratorNext(iterator))) { - parent = 0; + + while ((hidDevice = IOIteratorNext(iterator))) { + io_object_t parent = 0; IORegistryEntryGetParentEntry(hidDevice, kIOServicePlane, &parent); BOOL deviceWired = IOObjectConformsTo(parent, "Xbox360Peripheral") && IOObjectConformsTo(hidDevice, "Xbox360ControllerClass"); BOOL deviceWireless = IOObjectConformsTo(hidDevice, "WirelessHIDDevice"); @@ -551,57 +749,66 @@ - (void)updateDeviceList IOObjectRelease(hidDevice); continue; } - item=[DeviceItem allocateDeviceItemForDevice:hidDevice]; - if(item==NULL) continue; + DeviceItem *item = [DeviceItem allocateDeviceItemForDevice:hidDevice]; + if (item == nil) continue; // Add to item - NSString *name; - name = [item name]; + NSString *name = item.name; if (name == nil) name = @"Generic Controller"; - [deviceList addItemWithTitle:[NSString stringWithFormat:@"%i: %@ (%@)", ++count, name, deviceWireless ? @"Wireless" : @"Wired"]]; - [deviceArray addObject:item]; + [_deviceList addItemWithTitle:[NSString stringWithFormat:@"%i: %@ (%@)", ++count, name, deviceWireless ? @"Wireless" : @"Wired"]]; + [_deviceListBinding addItemWithTitle:[NSString stringWithFormat:@"%i: %@ (%@)", count, name, deviceWireless ? @"Wireless" : @"Wired"]]; + [_deviceListAdvanced addItemWithTitle:[NSString stringWithFormat:@"%i: %@ (%@)", count, name, deviceWireless ? @"Wireless" : @"Wired"]]; + [_deviceArray addObject:item]; } IOObjectRelease(iterator); - if(count==0) [deviceList addItemWithTitle:NO_ITEMS]; + if (count==0) { + [_deviceList addItemWithTitle:NO_ITEMS]; + [_deviceListBinding addItemWithTitle:NO_ITEMS]; + [_deviceListAdvanced addItemWithTitle:NO_ITEMS]; + } [self startDevice]; } // Start up -- (void)mainViewDidLoad +- (void)didSelect { io_object_t object; // Get master port, for accessing I/O Kit - IOMasterPort(MACH_PORT_NULL,&masterPort); + IOMasterPort(MACH_PORT_NULL,&_masterPort); // Set up notification of USB device addition/removal - notifyPort=IONotificationPortCreate(masterPort); + notifyPort=IONotificationPortCreate(_masterPort); notifySource=IONotificationPortGetRunLoopSource(notifyPort); - CFRunLoopAddSource(CFRunLoopGetCurrent(),notifySource,kCFRunLoopCommonModes); + CFRunLoopAddSource(CFRunLoopGetCurrent(), notifySource, kCFRunLoopCommonModes); // Prepare other fields - deviceArray=[[NSMutableArray arrayWithCapacity:1] retain]; + _deviceArray = [[NSMutableArray alloc] initWithCapacity:1]; device=NULL; hidQueue=NULL; // Activate callbacks // Wired - IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching(kIOUSBDeviceClassName), callbackHandleDevice, self, &onIteratorWired); - callbackHandleDevice(self, onIteratorWired); - IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, IOServiceMatching(kIOUSBDeviceClassName), callbackHandleDevice, self, &offIteratorWired); + IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching(kIOUSBDeviceClassName), callbackHandleDevice, (__bridge void *)(self), &onIteratorWired); + callbackHandleDevice((__bridge void *)(self), onIteratorWired); + IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, IOServiceMatching(kIOUSBDeviceClassName), callbackHandleDevice, (__bridge void *)(self), &offIteratorWired); while((object = IOIteratorNext(offIteratorWired)) != 0) IOObjectRelease(object); // Wireless - IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("WirelessHIDDevice"), callbackHandleDevice, self, &onIteratorWireless); - callbackHandleDevice(self, onIteratorWireless); - IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, IOServiceMatching("WirelessHIDDevice"), callbackHandleDevice, self, &offIteratorWireless); + IOServiceAddMatchingNotification(notifyPort, kIOFirstMatchNotification, IOServiceMatching("WirelessHIDDevice"), callbackHandleDevice, (__bridge void *)(self), &onIteratorWireless); + callbackHandleDevice((__bridge void *)(self), onIteratorWireless); + IOServiceAddMatchingNotification(notifyPort, kIOTerminatedNotification, IOServiceMatching("WirelessHIDDevice"), callbackHandleDevice, (__bridge void *)(self), &offIteratorWireless); while((object = IOIteratorNext(offIteratorWireless)) != 0) IOObjectRelease(object); + + // TEMP: Enable the "enable driver" checkbox if the kext is loaded in the memory + int result = system("kextstat | grep com.mice.driver.Xbox360Controller"); + NSLog(@"Result of kextstat = %d", result); + if (result == 0) { + [self.enableDriverCheckBox setEnabled:YES]; + } } // Shut down -- (void)dealloc +- (void)didUnselect { - int i; - DeviceItem *item; - FFEFFESCAPE escape; unsigned char c; // Remove notification source @@ -609,14 +816,14 @@ - (void)dealloc IOObjectRelease(onIteratorWireless); IOObjectRelease(offIteratorWired); IOObjectRelease(offIteratorWireless); - CFRunLoopRemoveSource(CFRunLoopGetCurrent(),notifySource,kCFRunLoopCommonModes); CFRunLoopSourceInvalidate(notifySource); IONotificationPortDestroy(notifyPort); // Release device and info [self stopDevice]; - for (i = 0; i < [deviceArray count]; i++) + for (DeviceItem *item in _deviceArray) { - item = [deviceArray objectAtIndex:i]; + FFEFFESCAPE escape = {0}; + NSInteger i = [_deviceArray indexOfObject:item]; if ([item ffDevice] == 0) continue; c = 0x06 + (i % 0x04); @@ -629,61 +836,247 @@ - (void)dealloc FFDeviceEscape([item ffDevice], &escape); } [self deleteDeviceList]; - [deviceArray release]; // Close master port - mach_port_deallocate(mach_task_self(),masterPort); + mach_port_deallocate(mach_task_self(), _masterPort); // Done - [super dealloc]; -} - -- (mach_port_t)masterPort -{ - return masterPort; } // Handle selection from drop down menu -- (void)selectDevice:(id)sender +- (IBAction)selectDevice:(id)sender { + NSInteger tabIndex = [_tabView indexOfTabViewItem:[_tabView selectedTabViewItem]]; + if (tabIndex == 0) { // Controller Test + [_deviceListBinding selectItemAtIndex:[_deviceList indexOfSelectedItem]]; + [_deviceListAdvanced selectItemAtIndex:[_deviceList indexOfSelectedItem]]; + } + else if (tabIndex == 1) { // Binding Tab + [_deviceList selectItemAtIndex:[_deviceListBinding indexOfSelectedItem]]; + [_deviceListAdvanced selectItemAtIndex:[_deviceListBinding indexOfSelectedItem]]; + } + else if (tabIndex == 2) { // Deadzones Tab + [_deviceList selectItemAtIndex:[_deviceListAdvanced indexOfSelectedItem]]; + [_deviceListBinding selectItemAtIndex:[_deviceListAdvanced indexOfSelectedItem]]; + } + [self startDevice]; } // Handle changing a setting -- (void)changeSetting:(id)sender +- (IBAction)changeSetting:(id)sender { - CFDictionaryRef dict; - CFStringRef keys[8]; - CFTypeRef values[8]; - UInt16 i; + // Send normalize to joysticks + [_wholeController setLeftNormalized:(BOOL)[_normalizeDeadzoneLeft state]]; + [_leftStickAnalog setNormalized:(BOOL)[_normalizeDeadzoneLeft state]]; + [_wholeController setRightNormalized:(BOOL)[_normalizeDeadzoneRight state]]; + [_rightStickAnalog setNormalized:(BOOL)[_normalizeDeadzoneRight state]]; + + // Sync settings between tabs + NSInteger tabIndex = [_tabView indexOfTabViewItem:[_tabView selectedTabViewItem]]; + + if (tabIndex == 0) { // Controller Test + [_leftLinkedAlt setState:[_leftLinked state]]; + [_leftStickDeadzoneAlt setDoubleValue:[_leftStickDeadzone doubleValue]]; + [_leftStickInvertXAlt setState:[_leftStickInvertX state]]; + [_leftStickInvertYAlt setState:[_leftStickInvertY state]]; + [_rightLinkedAlt setState:[_rightLinked state]]; + [_rightStickDeadzoneAlt setDoubleValue:[_rightStickDeadzone doubleValue]]; + [_rightStickInvertXAlt setState:[_rightStickInvertX state]]; + [_rightStickInvertYAlt setState:[_rightStickInvertY state]]; + } + else if (tabIndex == 2) { // Advanced Tab + [_leftLinked setState:[_leftLinkedAlt state]]; + [_leftStickDeadzone setDoubleValue:[_leftStickDeadzoneAlt doubleValue]]; + [_leftStickInvertX setState:[_leftStickInvertXAlt state]]; + [_leftStickInvertY setState:[_leftStickInvertYAlt state]]; + [_rightLinked setState:[_rightLinkedAlt state]]; + [_rightStickDeadzone setDoubleValue:[_rightStickDeadzoneAlt doubleValue]]; + [_rightStickInvertX setState:[_rightStickInvertXAlt state]]; + [_rightStickInvertY setState:[_rightStickInvertYAlt state]]; + } - // Set keys and values - keys[0]=CFSTR("InvertLeftX"); - values[0]=([leftStickInvertX state]==NSOnState)?kCFBooleanTrue:kCFBooleanFalse; - keys[1]=CFSTR("InvertLeftY"); - values[1]=([leftStickInvertY state]==NSOnState)?kCFBooleanTrue:kCFBooleanFalse; - keys[2]=CFSTR("InvertRightX"); - values[2]=([rightStickInvertX state]==NSOnState)?kCFBooleanTrue:kCFBooleanFalse; - keys[3]=CFSTR("InvertRightY"); - values[3]=([rightStickInvertY state]==NSOnState)?kCFBooleanTrue:kCFBooleanFalse; - keys[4]=CFSTR("DeadzoneLeft"); - i=[leftStickDeadzone doubleValue]; - values[4]=CFNumberCreate(NULL,kCFNumberShortType,&i); - keys[5]=CFSTR("DeadzoneRight"); - i=[rightStickDeadzone doubleValue]; - values[5]=CFNumberCreate(NULL,kCFNumberShortType,&i); - keys[6]=CFSTR("RelativeLeft"); - values[6]=([leftLinked state]==NSOnState)?kCFBooleanTrue:kCFBooleanFalse; - keys[7]=CFSTR("RelativeRight"); - values[7]=([rightLinked state]==NSOnState)?kCFBooleanTrue:kCFBooleanFalse; // Create dictionary - dict=CFDictionaryCreate(NULL,(const void**)keys,(const void**)values,sizeof(keys)/sizeof(keys[0]),&kCFTypeDictionaryKeyCallBacks,&kCFTypeDictionaryValueCallBacks); + NSDictionary *dict = @{@"InvertLeftX": @((BOOL)([_leftStickInvertX state]==NSOnState)), + @"InvertLeftY": @((BOOL)([_leftStickInvertY state]==NSOnState)), + @"InvertRightX": @((BOOL)([_rightStickInvertX state]==NSOnState)), + @"InvertRightY": @((BOOL)([_rightStickInvertY state]==NSOnState)), + @"DeadzoneLeft": @((UInt16)[_leftStickDeadzone doubleValue]), + @"DeadzoneRight": @((UInt16)[_rightStickDeadzone doubleValue]), + @"RelativeLeft": @((BOOL)([_leftLinked state]==NSOnState)), + @"RelativeRight": @((BOOL)([_rightLinked state]==NSOnState)), + @"DeadOffLeft": @((BOOL)([_normalizeDeadzoneLeft state]==NSOnState)), + @"DeadOffRight": @((BOOL)([_normalizeDeadzoneRight state]==NSOnState)), + @"ControllerType": @((UInt8)(controllerType)), + @"RumbleType": @((UInt8)([_rumbleOptions indexOfSelectedItem])), + @"BindingUp": @((UInt8)([MyWhole360ControllerMapper mapping][0])), + @"BindingDown": @((UInt8)([MyWhole360ControllerMapper mapping][1])), + @"BindingLeft": @((UInt8)([MyWhole360ControllerMapper mapping][2])), + @"BindingRight": @((UInt8)([MyWhole360ControllerMapper mapping][3])), + @"BindingStart": @((UInt8)([MyWhole360ControllerMapper mapping][4])), + @"BindingBack": @((UInt8)([MyWhole360ControllerMapper mapping][5])), + @"BindingLSC": @((UInt8)([MyWhole360ControllerMapper mapping][6])), + @"BindingRSC": @((UInt8)([MyWhole360ControllerMapper mapping][7])), + @"BindingLB": @((UInt8)([MyWhole360ControllerMapper mapping][8])), + @"BindingRB": @((UInt8)([MyWhole360ControllerMapper mapping][9])), + @"BindingGuide": @((UInt8)([MyWhole360ControllerMapper mapping][10])), + @"BindingA": @((UInt8)([MyWhole360ControllerMapper mapping][11])), + @"BindingB": @((UInt8)([MyWhole360ControllerMapper mapping][12])), + @"BindingX": @((UInt8)([MyWhole360ControllerMapper mapping][13])), + @"BindingY": @((UInt8)([MyWhole360ControllerMapper mapping][14]))}; + // Set property - IORegistryEntrySetCFProperties(registryEntry, dict); - SetController(GetSerialNumber(registryEntry), (NSDictionary*)dict); + IORegistryEntrySetCFProperties(registryEntry, (__bridge CFTypeRef)(dict)); + SetController(GetSerialNumber(registryEntry), dict); // Update UI - [leftStick setLinked:([leftLinked state]==NSOnState)]; - [leftStick setDeadzone:[leftStickDeadzone doubleValue]]; - [rightStick setLinked:([rightLinked state]==NSOnState)]; - [rightStick setDeadzone:[rightStickDeadzone doubleValue]]; + [_leftDeadZone setLinked:[_leftLinked state] == NSOnState]; + [_leftStickAnalog setLinked:[_leftLinked state] == NSOnState]; + [_leftDeadZone setVal:[_leftStickDeadzone doubleValue]]; + [_wholeController setLeftStickDeadzone:[_leftStickDeadzone doubleValue]]; + [_leftStickAnalog setDeadzone:[_leftStickDeadzone doubleValue]]; + [_rightDeadZone setLinked:[_rightLinked state] == NSOnState]; + [_rightStickAnalog setLinked:[_rightLinked state] == NSOnState]; + [_rightDeadZone setVal:[_rightStickDeadzone doubleValue]]; + [_wholeController setRightStickDeadzone:[_rightStickDeadzone doubleValue]]; + [_rightStickAnalog setDeadzone:[_rightStickDeadzone doubleValue]]; +} + +// Run an AppleScript from String and returns YES on successful execution +- (BOOL)runInlineAppleScript:(NSString *)scriptString +{ + NSDictionary* errorDict; + NSAppleEventDescriptor* returnDescriptor = NULL; + + NSAppleScript* scriptObject = [[NSAppleScript alloc] initWithSource:scriptString]; + + returnDescriptor = [scriptObject executeAndReturnError: &errorDict]; + scriptObject = nil; + + if (returnDescriptor != NULL) + { + // successful execution + if (kAENullEvent != [returnDescriptor descriptorType]) + { + return YES; + /* Uncomment this to handle the returned values */ +// // script returned an AppleScript result +// if (cAEList == [returnDescriptor descriptorType]) +// { +// // result is a list of other descriptors +// } +// else +// { +// // coerce the result to the appropriate ObjC type +// } + } + } + else + { + // no script result, handle error here + NSLog(@"APPLESCRIPT ERROR:\n%@\n,\n%@", returnDescriptor, errorDict); + } + return NO; +} + +// Enable/disable the driver +// FIXME: currently only works after the controller is connected and loaded once. +// FIXME: will not uncheck the "Enabled" box if the prefpane is started with the driver disabled +- (IBAction)toggleDriverEnabled:(NSButton *)sender +{ + NSLog(@"Enable/disable driver stuff: will change state..."); + NSString *script = nil; + + // QUESTION: should I disable the daemon too? + if (sender.state == NSOnState) { + // The driver should be enabled + NSLog(@"Will Enable Driver..."); + script = + @"do shell script \"\ + cd \\\"/Library/Extensions\\\"\n\ + kextload \\\"360Controller.kext\\\"\n\ + \" with administrator privileges\n"; + + } else if (sender.state == NSOffState) { + // The driver should be disabled + NSLog(@"Will Disable Driver..."); + [self powerOff:nil]; + [self stopDevice]; + + script = + @"do shell script \"\ + kextstat | grep 360Controller\n\ + if [ $? -eq 0 ]\n\ + then\n\ + kextunload -b \\\"com.mice.driver.Xbox360Controller\\\"\n\ + fi\n\ + \" with administrator privileges\n"; + } + + if (script != nil) { + if ([self runInlineAppleScript:script]) { + NSLog(@"...done!"); + sleep(1); + } + } + + [self updateDeviceList]; +} + +// Asks the user to uninstall the package, If YES, runs inline AppleScript to do that procedure. +- (IBAction)willPerformUninstallation:(id)sender +{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle:@"YES"]; + [alert addButtonWithTitle:@"NO"]; + [alert setMessageText:@"Do you want to uninstall?"]; + [alert setInformativeText:@"This operation cannot be undone."]; + [alert setAlertStyle:NSWarningAlertStyle]; + + if ([alert runModal] != NSAlertFirstButtonReturn) { + NSLog(@"Uninstallation canceled!"); + return; + } + + NSLog(@"Will uninstall the driver..."); + + // quotes must be double escaped so the script will read \" properly + NSString *script = + @"do shell script \"\ + launchctl unload /Library/LaunchDaemons/com.mice.360Daemon.plist\n\ + kextunload -b \\\"com.mice.driver.Xbox360Controller\\\"\n\ + kextunload -b \\\"com.mice.driver.Wireless360Controller\\\"\n\ + kextunload -b \\\"com.mice.driver.WirelessGamingReceiver\\\"\n\ + rm -f /Library/LaunchDaemons/com.mice.360Daemon.plist\n\ + rm -rf /Library/Application\\ Support/MICE/360Daemon.app\n\ + rm -rf /System/Library/Extensions/360Controller.kext\n\ + rm -rf /System/Library/Extensions/Wireless360Controller.kext\n\ + rm -rf /System/Library/Extensions/WirelessGamingReceiver.kext\n\ + rm -rf /Library/Extensions/360Controller.kext\n\ + rm -rf /Library/Extensions/Wireless360Controller.kext\n\ + rm -rf /Library/Extensions/WirelessGamingReceiver.kext\n\ + rm -rf /Library/PreferencePanes/Pref360Control.prefPane\n\ + pkgutil --forget com.mice.pkg.Xbox360controller\ + \" with administrator privileges"; + + if (script != nil && [self runInlineAppleScript:script]) { + NSLog(@"...done!"); + + alert = [NSAlert alertWithMessageText:@"Success!" + defaultButton:nil + alternateButton:nil + otherButton:nil + informativeTextWithFormat:@"The driver was uninstalled successfully!\n Note that you may need to restart your Mac to be able to install it again properly."]; + [alert runModal]; + + // close the Preference Panel, as it needs to clean stuff + [[NSApplication sharedApplication] terminate:nil]; + } else { + NSLog(@"...error!"); + alert = [NSAlert alertWithMessageText:@"Error!" + defaultButton:nil + alternateButton:nil + otherButton:nil + informativeTextWithFormat:@"Error Uninstalling the Driver!"]; + [alert runModal]; + } } // Handle I/O Kit device add/remove @@ -694,23 +1087,26 @@ - (void)handleDeviceChange [self updateDeviceList]; } -- (IBAction)showDeviceList:(id)sender -{ - [deviceLister showWithOwner:self]; -} - - (IBAction)powerOff:(id)sender { - FFEFFESCAPE escape; + FFEFFESCAPE escape = {0}; - if(ffDevice==0) return; + if (ffDevice == 0) return; escape.dwSize=sizeof(escape); escape.dwCommand=0x03; - escape.cbInBuffer=0; - escape.lpvInBuffer=NULL; - escape.cbOutBuffer=0; - escape.lpvOutBuffer=NULL; - FFDeviceEscape(ffDevice,&escape); + FFDeviceEscape(ffDevice, &escape); +} + +- (IBAction)startRemappingPressed:(id)sender { + if (![_wholeControllerMapper isMapping]) + [_wholeControllerMapper runMapperWithButton:_remappingButton andOwner:self]; + else + [_wholeControllerMapper reset]; +} + +- (IBAction)resetRemappingPressed:(id)sender { + [_remappingButton setState:NSOffState]; + [_wholeControllerMapper reset]; } @end diff --git a/Pref360Control/Pref360Control_Prefix.pch b/Pref360Control/Pref360Control_Prefix.pch index 5da80c0..11d1120 100644 --- a/Pref360Control/Pref360Control_Prefix.pch +++ b/Pref360Control/Pref360Control_Prefix.pch @@ -2,7 +2,15 @@ // Prefix header for all source files of the 'Pref360Control' target in the 'Pref360Control' project. // +@import CoreFoundation; +#include +#include +#include +#include +#include +#include + #ifdef __OBJC__ - #import - #import + @import Cocoa; + @import PreferencePanes; #endif diff --git a/Pref360Control/Pref360StyleKit.h b/Pref360Control/Pref360StyleKit.h new file mode 100644 index 0000000..1b1cf9b --- /dev/null +++ b/Pref360Control/Pref360StyleKit.h @@ -0,0 +1,23 @@ +// +// Pref360StyleKit.h +// Pref360Control +// +// Created by Pierre TACCHI on 25/01/15. +// Copyright (c) 2015 . All rights reserved. +// +// Generated by PaintCode (www.paintcodeapp.com) +// + +#import +#import + + +@interface Pref360StyleKit : NSObject + +// Drawing Methods ++ (void)drawX360ControllerWithControllerNumber: (CGFloat)controllerNumber aPressed: (BOOL)aPressed bPressed: (BOOL)bPressed xPressed: (BOOL)xPressed yPressed: (BOOL)yPressed leftPressed: (BOOL)leftPressed upPressed: (BOOL)upPressed rightPressed: (BOOL)rightPressed downPressed: (BOOL)downPressed backPressed: (BOOL)backPressed startPressed: (BOOL)startPressed lbPressed: (BOOL)lbPressed rbPressed: (BOOL)rbPressed homePressed: (BOOL)homePressed leftStickPressed: (BOOL)leftStickPressed rightStickPressed: (BOOL)rightStickPressed leftStick: (NSPoint)leftStick rightStick: (NSPoint)rightStick leftStickDeadzone: (CGFloat)leftDeadzone rightStickDeadzone: (CGFloat)rightDeadzone isLeftNormalized: (BOOL)leftNormalized isRightNormalized: (BOOL)rightNormalized; ++ (void)drawTriggerMetterWithIntensity: (CGFloat)intensity triggerTitle: (NSString*)triggerTitle; ++ (void)drawBatteryMonitorWithBars: (CGFloat)bars; ++ (void)drawDeadZoneViewerWithValue: (CGFloat)value linked: (BOOL)linked; + +@end diff --git a/Pref360Control/Pref360StyleKit.m b/Pref360Control/Pref360StyleKit.m new file mode 100644 index 0000000..92e32f4 --- /dev/null +++ b/Pref360Control/Pref360StyleKit.m @@ -0,0 +1,1292 @@ +// +// Pref360StyleKit.m +// Pref360Control +// +// Created by Pierre TACCHI on 25/01/15. +// Copyright (c) 2015 . All rights reserved. +// +// Generated by PaintCode (www.paintcodeapp.com) +// + +#import "Pref360StyleKit.h" + + +@implementation Pref360StyleKit + +#pragma mark Initialization + ++ (void)initialize +{ +} + +#pragma mark Drawing Methods + ++ (void)drawX360ControllerWithControllerNumber: (CGFloat)controllerNumber aPressed: (BOOL)aPressed bPressed: (BOOL)bPressed xPressed: (BOOL)xPressed yPressed: (BOOL)yPressed leftPressed: (BOOL)leftPressed upPressed: (BOOL)upPressed rightPressed: (BOOL)rightPressed downPressed: (BOOL)downPressed backPressed: (BOOL)backPressed startPressed: (BOOL)startPressed lbPressed: (BOOL)lbPressed rbPressed: (BOOL)rbPressed homePressed: (BOOL)homePressed leftStickPressed: (BOOL)leftStickPressed rightStickPressed: (BOOL)rightStickPressed leftStick: (NSPoint)leftStick rightStick: (NSPoint)rightStick leftStickDeadzone: (CGFloat)leftDeadzone rightStickDeadzone: (CGFloat)rightDeadzone isLeftNormalized: (BOOL)leftNormalized isRightNormalized: (BOOL)rightNormalized +{ + //// General Declarations + CGContextRef context = (CGContextRef)NSGraphicsContext.currentContext.graphicsPort; + + //// Color Declarations + NSColor* buttonX = [NSColor colorWithCalibratedRed: 0.124 green: 0.351 blue: 1 alpha: 1]; + NSColor* strokeX = [buttonX shadowWithLevel: 0.5]; + NSColor* buttonA = [NSColor colorWithCalibratedRed: 0.524 green: 0.883 blue: 0 alpha: 1]; + NSColor* strokeA = [buttonA shadowWithLevel: 0.5]; + NSColor* buttonB = [NSColor colorWithCalibratedRed: 1 green: 0.094 blue: 0.072 alpha: 1]; + NSColor* strokeB = [buttonB shadowWithLevel: 0.5]; + NSColor* buttonY = [NSColor colorWithCalibratedRed: 1 green: 0.814 blue: 0.047 alpha: 1]; + NSColor* strokeY = [buttonY shadowWithLevel: 0.5]; + NSColor* buttonHOME = [NSColor colorWithCalibratedRed: 0.895 green: 0.895 blue: 0.895 alpha: 1]; + NSColor* strokeHOME = [buttonHOME shadowWithLevel: 0.5]; + NSColor* controller = [NSColor colorWithCalibratedRed: 0.232 green: 0.232 blue: 0.232 alpha: 1]; + NSColor* backController = [controller highlightWithLevel: 0.4]; + NSColor* darkController = [controller shadowWithLevel: 0.3]; + NSColor* highlightController = [controller highlightWithLevel: 0.1]; + NSColor* stick = [NSColor colorWithCalibratedRed: 0.305 green: 0.335 blue: 0.28 alpha: 1]; + NSColor* highlightStick = [stick highlightWithLevel: 0.3]; + NSColor* shadowStick = [stick shadowWithLevel: 0.2]; + NSColor* pressed = [NSColor colorWithCalibratedRed: 1 green: 0.432 blue: 0 alpha: 1]; + NSColor* pressedStroke = [pressed shadowWithLevel: 0.5]; + NSColor* cross = [NSColor colorWithCalibratedRed: 0.372 green: 0.372 blue: 0.372 alpha: 1]; + NSColor* crossStroke = [cross shadowWithLevel: 0.5]; + NSColor* gradientColor = [NSColor colorWithCalibratedRed: 0 green: 0 blue: 0 alpha: 0.355]; + NSColor* gradientColor2 = [NSColor colorWithCalibratedRed: 0 green: 0 blue: 0 alpha: 0]; + + //// Gradient Declarations + NSGradient* gradient = [NSGradient.alloc initWithStartingColor: gradientColor endingColor: gradientColor2]; + + //// Variable Declarations + NSColor* led1Color = controllerNumber == 1 ? buttonA : strokeA; + NSColor* led2Color = controllerNumber == 2 ? buttonA : strokeA; + NSColor* led3Color = controllerNumber == 3 ? buttonA : strokeA; + NSColor* led4Color = controllerNumber == 4 ? buttonA : strokeA; + NSColor* aColor = aPressed ? pressed : buttonA; + NSColor* aStroke = aPressed ? pressedStroke : strokeA; + NSColor* bColor = bPressed ? pressed : buttonB; + NSColor* bStroke = bPressed ? pressedStroke : strokeB; + NSColor* xColor = xPressed ? pressed : buttonX; + NSColor* xStroke = xPressed ? pressedStroke : strokeX; + NSColor* yColor = yPressed ? pressed : buttonY; + NSColor* yStroke = yPressed ? pressedStroke : strokeY; + NSColor* backColor = backPressed ? pressed : controller; + NSColor* backStroke = backPressed ? pressedStroke : darkController; + NSColor* startColor = startPressed ? pressed : controller; + NSColor* startStroke = startPressed ? pressedStroke : darkController; + NSColor* lbColor = lbPressed ? pressed : darkController; + CGFloat leftAngle = lbPressed ? 2.5 : 0; + NSColor* rbColor = rbPressed ? pressed : darkController; + CGFloat rightAngle = rbPressed ? -2.5 : 0; + NSColor* homeColor = homePressed ? pressed : buttonHOME; + NSColor* homeStroke = homePressed ? pressedStroke : strokeHOME; + NSColor* leftStickColor = leftStickPressed ? pressed : stick; + NSColor* leftStickStroke = leftStickPressed ? pressedStroke : shadowStick; + NSColor* rightStickColor = rightStickPressed ? pressed : stick; + NSColor* rightStickStroke = rightStickPressed ? pressedStroke : shadowStick; + NSPoint leftStickPosition = NSMakePoint(leftStick.x * 15, -leftStick.y * 15); + NSPoint rightStickPosition = NSMakePoint(rightStick.x * 15, -rightStick.y * 15); + + //// right shoulder Drawing + [NSGraphicsContext saveGraphicsState]; + CGContextTranslateCTM(context, 319, 284); + CGContextRotateCTM(context, rightAngle * M_PI / 180); + + NSBezierPath* rightShoulderPath = NSBezierPath.bezierPath; + [rightShoulderPath moveToPoint: NSMakePoint(75.66, 2.83)]; + [rightShoulderPath curveToPoint: NSMakePoint(74.51, 15.43) controlPoint1: NSMakePoint(76.42, 14.82) controlPoint2: NSMakePoint(75.86, 12.28)]; + [rightShoulderPath curveToPoint: NSMakePoint(39.25, 32.38) controlPoint1: NSMakePoint(73.16, 18.58) controlPoint2: NSMakePoint(52.17, 30.17)]; + [rightShoulderPath curveToPoint: NSMakePoint(5.16, 34.04) controlPoint1: NSMakePoint(26.34, 34.59) controlPoint2: NSMakePoint(11.96, 36.06)]; + [rightShoulderPath curveToPoint: NSMakePoint(2.29, 28.14) controlPoint1: NSMakePoint(5.72, 29.92) controlPoint2: NSMakePoint(2.29, 28.14)]; + [rightShoulderPath lineToPoint: NSMakePoint(0, 26.48)]; + [rightShoulderPath lineToPoint: NSMakePoint(3.45, 20.76)]; + [rightShoulderPath curveToPoint: NSMakePoint(75.66, 2.83) controlPoint1: NSMakePoint(3.45, 20.76) controlPoint2: NSMakePoint(74.91, -9.15)]; + [rightShoulderPath closePath]; + [rbColor setFill]; + [rightShoulderPath fill]; + + [NSGraphicsContext restoreGraphicsState]; + + + //// leftShoulder Drawing + [NSGraphicsContext saveGraphicsState]; + CGContextTranslateCTM(context, 145, 284); + CGContextRotateCTM(context, leftAngle * M_PI / 180); + + NSBezierPath* leftShoulderPath = NSBezierPath.bezierPath; + [leftShoulderPath moveToPoint: NSMakePoint(-75.41, 2.83)]; + [leftShoulderPath curveToPoint: NSMakePoint(-74.26, 15.43) controlPoint1: NSMakePoint(-76.16, 14.82) controlPoint2: NSMakePoint(-75.6, 12.28)]; + [leftShoulderPath curveToPoint: NSMakePoint(-39, 32.38) controlPoint1: NSMakePoint(-72.91, 18.58) controlPoint2: NSMakePoint(-51.91, 30.17)]; + [leftShoulderPath curveToPoint: NSMakePoint(-4.9, 34.04) controlPoint1: NSMakePoint(-26.09, 34.59) controlPoint2: NSMakePoint(-11.71, 36.06)]; + [leftShoulderPath curveToPoint: NSMakePoint(-2.04, 28.14) controlPoint1: NSMakePoint(-5.47, 29.92) controlPoint2: NSMakePoint(-2.04, 28.14)]; + [leftShoulderPath lineToPoint: NSMakePoint(0.25, 26.48)]; + [leftShoulderPath lineToPoint: NSMakePoint(-3.19, 20.76)]; + [leftShoulderPath curveToPoint: NSMakePoint(-75.41, 2.83) controlPoint1: NSMakePoint(-3.19, 20.76) controlPoint2: NSMakePoint(-74.66, -9.15)]; + [leftShoulderPath closePath]; + [lbColor setFill]; + [leftShoulderPath fill]; + + [NSGraphicsContext restoreGraphicsState]; + + + //// Body + { + //// underPiece Drawing + NSBezierPath* underPiecePath = NSBezierPath.bezierPath; + [underPiecePath moveToPoint: NSMakePoint(232.47, 90.1)]; + [underPiecePath curveToPoint: NSMakePoint(257.11, 90.01) controlPoint1: NSMakePoint(232.47, 90.1) controlPoint2: NSMakePoint(241.06, 90.1)]; + [underPiecePath curveToPoint: NSMakePoint(296.1, 85.05) controlPoint1: NSMakePoint(273.16, 89.92) controlPoint2: NSMakePoint(285.23, 88.69)]; + [underPiecePath curveToPoint: NSMakePoint(336.04, 62.49) controlPoint1: NSMakePoint(306.97, 81.4) controlPoint2: NSMakePoint(322.76, 75.77)]; + [underPiecePath curveToPoint: NSMakePoint(389.02, 18.76) controlPoint1: NSMakePoint(349.33, 49.2) controlPoint2: NSMakePoint(378.51, 23.74)]; + [underPiecePath curveToPoint: NSMakePoint(419.68, 12.97) controlPoint1: NSMakePoint(399.54, 13.78) controlPoint2: NSMakePoint(410.82, 12.97)]; + [underPiecePath curveToPoint: NSMakePoint(386.19, 35.56) controlPoint1: NSMakePoint(428.53, 12.97) controlPoint2: NSMakePoint(386.19, 35.56)]; + [underPiecePath lineToPoint: NSMakePoint(337.38, 78.46)]; + [underPiecePath lineToPoint: NSMakePoint(304.07, 97.28)]; + [underPiecePath lineToPoint: NSMakePoint(232.47, 108.05)]; + [underPiecePath lineToPoint: NSMakePoint(160.86, 97.28)]; + [underPiecePath lineToPoint: NSMakePoint(127.55, 78.46)]; + [underPiecePath lineToPoint: NSMakePoint(78.75, 35.56)]; + [underPiecePath curveToPoint: NSMakePoint(45.26, 12.97) controlPoint1: NSMakePoint(78.75, 35.56) controlPoint2: NSMakePoint(36.4, 12.97)]; + [underPiecePath curveToPoint: NSMakePoint(75.91, 18.76) controlPoint1: NSMakePoint(54.11, 12.97) controlPoint2: NSMakePoint(65.39, 13.78)]; + [underPiecePath curveToPoint: NSMakePoint(128.89, 62.49) controlPoint1: NSMakePoint(86.43, 23.74) controlPoint2: NSMakePoint(115.6, 49.2)]; + [underPiecePath curveToPoint: NSMakePoint(168.84, 85.05) controlPoint1: NSMakePoint(142.17, 75.77) controlPoint2: NSMakePoint(157.97, 81.4)]; + [underPiecePath curveToPoint: NSMakePoint(207.83, 90.01) controlPoint1: NSMakePoint(179.7, 88.69) controlPoint2: NSMakePoint(191.77, 89.92)]; + [underPiecePath curveToPoint: NSMakePoint(232.47, 90.1) controlPoint1: NSMakePoint(223.88, 90.1) controlPoint2: NSMakePoint(232.47, 90.1)]; + [underPiecePath closePath]; + [backController setFill]; + [underPiecePath fill]; + + + //// upperPiece Drawing + NSBezierPath* upperPiecePath = NSBezierPath.bezierPath; + [upperPiecePath moveToPoint: NSMakePoint(326.27, 297.74)]; + [upperPiecePath lineToPoint: NSMakePoint(317.45, 309.05)]; + [upperPiecePath curveToPoint: NSMakePoint(287.1, 295.84) controlPoint1: NSMakePoint(317.45, 309.05) controlPoint2: NSMakePoint(297.62, 299)]; + [upperPiecePath curveToPoint: NSMakePoint(256.74, 291.86) controlPoint1: NSMakePoint(276.58, 292.68) controlPoint2: NSMakePoint(265.74, 291.86)]; + [upperPiecePath curveToPoint: NSMakePoint(232.14, 291.86) controlPoint1: NSMakePoint(247.75, 291.86) controlPoint2: NSMakePoint(232.14, 291.86)]; + [upperPiecePath curveToPoint: NSMakePoint(207.54, 291.86) controlPoint1: NSMakePoint(232.14, 291.86) controlPoint2: NSMakePoint(216.54, 291.86)]; + [upperPiecePath curveToPoint: NSMakePoint(177.19, 295.84) controlPoint1: NSMakePoint(198.55, 291.86) controlPoint2: NSMakePoint(187.71, 292.68)]; + [upperPiecePath curveToPoint: NSMakePoint(146.84, 309.05) controlPoint1: NSMakePoint(166.67, 299) controlPoint2: NSMakePoint(146.84, 309.05)]; + [upperPiecePath lineToPoint: NSMakePoint(138.02, 297.74)]; + [upperPiecePath lineToPoint: NSMakePoint(155.56, 278.49)]; + [upperPiecePath lineToPoint: NSMakePoint(232.14, 262.55)]; + [upperPiecePath lineToPoint: NSMakePoint(317.45, 278.49)]; + [upperPiecePath lineToPoint: NSMakePoint(326.27, 297.74)]; + [upperPiecePath closePath]; + [darkController setFill]; + [upperPiecePath fill]; + + + //// mainPiece Drawing + NSBezierPath* mainPiecePath = NSBezierPath.bezierPath; + [mainPiecePath moveToPoint: NSMakePoint(232, 98.24)]; + [mainPiecePath curveToPoint: NSMakePoint(199.49, 98.26) controlPoint1: NSMakePoint(232, 98.24) controlPoint2: NSMakePoint(218.98, 98.26)]; + [mainPiecePath curveToPoint: NSMakePoint(138.69, 81.37) controlPoint1: NSMakePoint(180.01, 98.26) controlPoint2: NSMakePoint(156.34, 94.14)]; + [mainPiecePath curveToPoint: NSMakePoint(95.6, 43.69) controlPoint1: NSMakePoint(121.04, 68.61) controlPoint2: NSMakePoint(108.77, 56.87)]; + [mainPiecePath curveToPoint: NSMakePoint(57.75, 13.88) controlPoint1: NSMakePoint(82.43, 30.52) controlPoint2: NSMakePoint(64.46, 16.16)]; + [mainPiecePath curveToPoint: NSMakePoint(32.63, 15.05) controlPoint1: NSMakePoint(51.04, 11.59) controlPoint2: NSMakePoint(38.05, 12.26)]; + [mainPiecePath curveToPoint: NSMakePoint(19.8, 29.28) controlPoint1: NSMakePoint(27.21, 17.84) controlPoint2: NSMakePoint(24.05, 21.26)]; + [mainPiecePath curveToPoint: NSMakePoint(12.25, 56.33) controlPoint1: NSMakePoint(15.55, 37.31) controlPoint2: NSMakePoint(13.81, 44.39)]; + [mainPiecePath curveToPoint: NSMakePoint(12.42, 103.97) controlPoint1: NSMakePoint(10.69, 68.26) controlPoint2: NSMakePoint(10.42, 83.87)]; + [mainPiecePath curveToPoint: NSMakePoint(19.13, 150.74) controlPoint1: NSMakePoint(14.42, 124.07) controlPoint2: NSMakePoint(15.78, 132)]; + [mainPiecePath curveToPoint: NSMakePoint(33.86, 208.39) controlPoint1: NSMakePoint(22.49, 169.47) controlPoint2: NSMakePoint(28.2, 189.55)]; + [mainPiecePath curveToPoint: NSMakePoint(52.42, 261.72) controlPoint1: NSMakePoint(39.51, 227.24) controlPoint2: NSMakePoint(48.55, 251.39)]; + [mainPiecePath curveToPoint: NSMakePoint(67.84, 292.19) controlPoint1: NSMakePoint(56.3, 272.06) controlPoint2: NSMakePoint(61.45, 286.91)]; + [mainPiecePath curveToPoint: NSMakePoint(99.81, 307.81) controlPoint1: NSMakePoint(74.22, 297.48) controlPoint2: NSMakePoint(85.43, 303.66)]; + [mainPiecePath curveToPoint: NSMakePoint(136.77, 310.82) controlPoint1: NSMakePoint(114.19, 311.96) controlPoint2: NSMakePoint(130.32, 312.02)]; + [mainPiecePath curveToPoint: NSMakePoint(153.53, 302.45) controlPoint1: NSMakePoint(143.23, 309.63) controlPoint2: NSMakePoint(145.42, 307.99)]; + [mainPiecePath curveToPoint: NSMakePoint(172.67, 290.01) controlPoint1: NSMakePoint(161.65, 296.92) controlPoint2: NSMakePoint(166.26, 293.18)]; + [mainPiecePath curveToPoint: NSMakePoint(198.91, 282.53) controlPoint1: NSMakePoint(179.08, 286.83) controlPoint2: NSMakePoint(187.74, 283.91)]; + [mainPiecePath curveToPoint: NSMakePoint(232, 280.48) controlPoint1: NSMakePoint(210.07, 281.15) controlPoint2: NSMakePoint(225.73, 280.57)]; + [mainPiecePath curveToPoint: NSMakePoint(265.09, 282.53) controlPoint1: NSMakePoint(238.27, 280.57) controlPoint2: NSMakePoint(253.93, 281.15)]; + [mainPiecePath curveToPoint: NSMakePoint(291.33, 290.01) controlPoint1: NSMakePoint(276.26, 283.91) controlPoint2: NSMakePoint(284.92, 286.83)]; + [mainPiecePath curveToPoint: NSMakePoint(310.47, 302.45) controlPoint1: NSMakePoint(297.74, 293.18) controlPoint2: NSMakePoint(302.35, 296.92)]; + [mainPiecePath curveToPoint: NSMakePoint(327.23, 310.82) controlPoint1: NSMakePoint(318.58, 307.99) controlPoint2: NSMakePoint(320.77, 309.63)]; + [mainPiecePath curveToPoint: NSMakePoint(364.19, 307.81) controlPoint1: NSMakePoint(333.68, 312.02) controlPoint2: NSMakePoint(349.81, 311.96)]; + [mainPiecePath curveToPoint: NSMakePoint(396.16, 292.19) controlPoint1: NSMakePoint(378.57, 303.66) controlPoint2: NSMakePoint(389.78, 297.48)]; + [mainPiecePath curveToPoint: NSMakePoint(411.58, 261.72) controlPoint1: NSMakePoint(402.55, 286.91) controlPoint2: NSMakePoint(407.7, 272.06)]; + [mainPiecePath curveToPoint: NSMakePoint(430.14, 208.39) controlPoint1: NSMakePoint(415.45, 251.39) controlPoint2: NSMakePoint(424.49, 227.24)]; + [mainPiecePath curveToPoint: NSMakePoint(444.87, 150.74) controlPoint1: NSMakePoint(435.8, 189.55) controlPoint2: NSMakePoint(441.51, 169.47)]; + [mainPiecePath curveToPoint: NSMakePoint(451.58, 103.97) controlPoint1: NSMakePoint(448.22, 132) controlPoint2: NSMakePoint(449.58, 124.07)]; + [mainPiecePath curveToPoint: NSMakePoint(451.75, 56.33) controlPoint1: NSMakePoint(453.58, 83.87) controlPoint2: NSMakePoint(453.31, 68.26)]; + [mainPiecePath curveToPoint: NSMakePoint(444.2, 29.28) controlPoint1: NSMakePoint(450.19, 44.39) controlPoint2: NSMakePoint(448.45, 37.31)]; + [mainPiecePath curveToPoint: NSMakePoint(431.37, 15.05) controlPoint1: NSMakePoint(439.95, 21.26) controlPoint2: NSMakePoint(436.79, 17.84)]; + [mainPiecePath curveToPoint: NSMakePoint(406.25, 13.88) controlPoint1: NSMakePoint(425.95, 12.26) controlPoint2: NSMakePoint(412.96, 11.59)]; + [mainPiecePath curveToPoint: NSMakePoint(368.4, 43.69) controlPoint1: NSMakePoint(399.54, 16.16) controlPoint2: NSMakePoint(382.98, 29.55)]; + [mainPiecePath curveToPoint: NSMakePoint(325.31, 81.37) controlPoint1: NSMakePoint(353.82, 57.83) controlPoint2: NSMakePoint(342.96, 68.61)]; + [mainPiecePath curveToPoint: NSMakePoint(264.51, 98.26) controlPoint1: NSMakePoint(307.66, 94.14) controlPoint2: NSMakePoint(283.99, 98.26)]; + [mainPiecePath curveToPoint: NSMakePoint(232, 98.24) controlPoint1: NSMakePoint(245.02, 98.26) controlPoint2: NSMakePoint(232, 98.24)]; + [mainPiecePath closePath]; + [controller setFill]; + [mainPiecePath fill]; + + + //// Bezier 6 Drawing + NSBezierPath* bezier6Path = NSBezierPath.bezierPath; + [bezier6Path moveToPoint: NSMakePoint(137.17, 310.95)]; + [bezier6Path curveToPoint: NSMakePoint(153.95, 302.58) controlPoint1: NSMakePoint(143.63, 309.75) controlPoint2: NSMakePoint(145.82, 308.12)]; + [bezier6Path curveToPoint: NSMakePoint(173.1, 290.14) controlPoint1: NSMakePoint(162.07, 297.05) controlPoint2: NSMakePoint(166.68, 293.31)]; + [bezier6Path curveToPoint: NSMakePoint(199.35, 282.66) controlPoint1: NSMakePoint(179.51, 286.96) controlPoint2: NSMakePoint(188.18, 284.04)]; + [bezier6Path curveToPoint: NSMakePoint(232.47, 280.6) controlPoint1: NSMakePoint(210.52, 281.27) controlPoint2: NSMakePoint(226.19, 280.69)]; + [bezier6Path curveToPoint: NSMakePoint(265.58, 282.66) controlPoint1: NSMakePoint(238.74, 280.69) controlPoint2: NSMakePoint(254.41, 281.27)]; + [bezier6Path curveToPoint: NSMakePoint(291.84, 290.14) controlPoint1: NSMakePoint(276.75, 284.04) controlPoint2: NSMakePoint(285.42, 286.96)]; + [bezier6Path curveToPoint: NSMakePoint(310.99, 302.58) controlPoint1: NSMakePoint(298.25, 293.31) controlPoint2: NSMakePoint(302.86, 297.05)]; + [bezier6Path curveToPoint: NSMakePoint(327.76, 310.95) controlPoint1: NSMakePoint(319.11, 308.12) controlPoint2: NSMakePoint(321.3, 309.75)]; + [bezier6Path curveToPoint: NSMakePoint(364.75, 307.94) controlPoint1: NSMakePoint(334.22, 312.15) controlPoint2: NSMakePoint(350.36, 312.09)]; + [bezier6Path curveToPoint: NSMakePoint(396.75, 292.32) controlPoint1: NSMakePoint(379.14, 303.79) controlPoint2: NSMakePoint(390.36, 297.61)]; + [bezier6Path curveToPoint: NSMakePoint(400.42, 288.13) controlPoint1: NSMakePoint(398.02, 291.27) controlPoint2: NSMakePoint(399.24, 289.83)]; + [bezier6Path curveToPoint: NSMakePoint(344.12, 305.03) controlPoint1: NSMakePoint(382.74, 295.64) controlPoint2: NSMakePoint(359.83, 304.98)]; + [bezier6Path curveToPoint: NSMakePoint(304.61, 289.92) controlPoint1: NSMakePoint(324.85, 305.1) controlPoint2: NSMakePoint(319.18, 300.27)]; + [bezier6Path curveToPoint: NSMakePoint(261.8, 273.12) controlPoint1: NSMakePoint(290.05, 279.57) controlPoint2: NSMakePoint(275.66, 274.04)]; + [bezier6Path curveToPoint: NSMakePoint(243.28, 272.63) controlPoint1: NSMakePoint(255.52, 272.7) controlPoint2: NSMakePoint(248.78, 272.61)]; + [bezier6Path curveToPoint: NSMakePoint(232.14, 272.63) controlPoint1: NSMakePoint(236.64, 272.65) controlPoint2: NSMakePoint(232.14, 272.63)]; + [bezier6Path curveToPoint: NSMakePoint(221.01, 272.63) controlPoint1: NSMakePoint(232.14, 272.63) controlPoint2: NSMakePoint(227.65, 272.65)]; + [bezier6Path curveToPoint: NSMakePoint(202.49, 273.12) controlPoint1: NSMakePoint(215.51, 272.61) controlPoint2: NSMakePoint(208.77, 272.7)]; + [bezier6Path curveToPoint: NSMakePoint(159.67, 289.92) controlPoint1: NSMakePoint(188.63, 274.04) controlPoint2: NSMakePoint(174.24, 279.57)]; + [bezier6Path curveToPoint: NSMakePoint(120.17, 305.03) controlPoint1: NSMakePoint(145.11, 300.27) controlPoint2: NSMakePoint(139.44, 305.1)]; + [bezier6Path curveToPoint: NSMakePoint(64.79, 288.52) controlPoint1: NSMakePoint(104.73, 304.98) controlPoint2: NSMakePoint(82.34, 295.96)]; + [bezier6Path curveToPoint: NSMakePoint(68.19, 292.32) controlPoint1: NSMakePoint(65.88, 290.05) controlPoint2: NSMakePoint(67.01, 291.35)]; + [bezier6Path curveToPoint: NSMakePoint(100.18, 307.94) controlPoint1: NSMakePoint(74.57, 297.61) controlPoint2: NSMakePoint(85.79, 303.79)]; + [bezier6Path curveToPoint: NSMakePoint(137.17, 310.95) controlPoint1: NSMakePoint(114.57, 312.09) controlPoint2: NSMakePoint(130.72, 312.15)]; + [bezier6Path closePath]; + [highlightController setFill]; + [bezier6Path fill]; + + + //// Oval Drawing + NSBezierPath* ovalPath = NSBezierPath.bezierPath; + [ovalPath moveToPoint: NSMakePoint(327.06, 123.32)]; + [ovalPath curveToPoint: NSMakePoint(327.06, 194.38) controlPoint1: NSMakePoint(346.1, 142.94) controlPoint2: NSMakePoint(346.1, 174.76)]; + [ovalPath curveToPoint: NSMakePoint(258.12, 194.38) controlPoint1: NSMakePoint(308.02, 214.01) controlPoint2: NSMakePoint(277.16, 214.01)]; + [ovalPath curveToPoint: NSMakePoint(258.12, 123.32) controlPoint1: NSMakePoint(239.08, 174.76) controlPoint2: NSMakePoint(239.08, 142.94)]; + [ovalPath curveToPoint: NSMakePoint(327.06, 123.32) controlPoint1: NSMakePoint(277.16, 103.69) controlPoint2: NSMakePoint(308.02, 103.69)]; + [ovalPath closePath]; + [darkController setStroke]; + [ovalPath setLineWidth: 1]; + [ovalPath stroke]; + + + //// Oval 4 Drawing + NSBezierPath* oval4Path = NSBezierPath.bezierPath; + [oval4Path moveToPoint: NSMakePoint(136.58, 207.39)]; + [oval4Path curveToPoint: NSMakePoint(136.58, 271.56) controlPoint1: NSMakePoint(154.59, 225.11) controlPoint2: NSMakePoint(154.59, 253.84)]; + [oval4Path curveToPoint: NSMakePoint(71.35, 271.56) controlPoint1: NSMakePoint(118.57, 289.28) controlPoint2: NSMakePoint(89.36, 289.28)]; + [oval4Path curveToPoint: NSMakePoint(71.35, 207.39) controlPoint1: NSMakePoint(53.34, 253.84) controlPoint2: NSMakePoint(53.34, 225.11)]; + [oval4Path curveToPoint: NSMakePoint(136.58, 207.39) controlPoint1: NSMakePoint(89.36, 189.67) controlPoint2: NSMakePoint(118.57, 189.67)]; + [oval4Path closePath]; + [darkController setStroke]; + [oval4Path setLineWidth: 1]; + [oval4Path stroke]; + + + //// Oval 2 Drawing + NSBezierPath* oval2Path = NSBezierPath.bezierPath; + [oval2Path moveToPoint: NSMakePoint(200.35, 125.54)]; + [oval2Path curveToPoint: NSMakePoint(200.35, 196.4) controlPoint1: NSMakePoint(219.76, 145.11) controlPoint2: NSMakePoint(219.76, 176.83)]; + [oval2Path curveToPoint: NSMakePoint(130.07, 196.4) controlPoint1: NSMakePoint(180.94, 215.97) controlPoint2: NSMakePoint(149.48, 215.97)]; + [oval2Path curveToPoint: NSMakePoint(130.07, 125.54) controlPoint1: NSMakePoint(110.67, 176.83) controlPoint2: NSMakePoint(110.67, 145.11)]; + [oval2Path curveToPoint: NSMakePoint(200.35, 125.54) controlPoint1: NSMakePoint(149.48, 105.97) controlPoint2: NSMakePoint(180.94, 105.97)]; + [oval2Path closePath]; + [darkController setStroke]; + [oval2Path setLineWidth: 1]; + [oval2Path stroke]; + + + //// Oval 8 Drawing + NSBezierPath* oval8Path = NSBezierPath.bezierPath; + [oval8Path moveToPoint: NSMakePoint(325, 163.5)]; + [oval8Path curveToPoint: NSMakePoint(293.5, 195) controlPoint1: NSMakePoint(325, 180.9) controlPoint2: NSMakePoint(310.9, 195)]; + [oval8Path curveToPoint: NSMakePoint(262, 163.5) controlPoint1: NSMakePoint(276.1, 195) controlPoint2: NSMakePoint(262, 180.9)]; + [oval8Path curveToPoint: NSMakePoint(293.5, 132) controlPoint1: NSMakePoint(262, 146.1) controlPoint2: NSMakePoint(276.1, 132)]; + [oval8Path curveToPoint: NSMakePoint(325, 163.5) controlPoint1: NSMakePoint(310.9, 132) controlPoint2: NSMakePoint(325, 146.1)]; + [oval8Path closePath]; + [highlightStick setFill]; + [oval8Path fill]; + [darkController setStroke]; + [oval8Path setLineWidth: 2]; + [oval8Path stroke]; + + + //// Oval 6 Drawing + NSBezierPath* oval6Path = NSBezierPath.bezierPath; + [oval6Path moveToPoint: NSMakePoint(135, 240.5)]; + [oval6Path curveToPoint: NSMakePoint(103.5, 272) controlPoint1: NSMakePoint(135, 257.9) controlPoint2: NSMakePoint(120.9, 272)]; + [oval6Path curveToPoint: NSMakePoint(72, 240.5) controlPoint1: NSMakePoint(86.1, 272) controlPoint2: NSMakePoint(72, 257.9)]; + [oval6Path curveToPoint: NSMakePoint(103.5, 209) controlPoint1: NSMakePoint(72, 223.1) controlPoint2: NSMakePoint(86.1, 209)]; + [oval6Path curveToPoint: NSMakePoint(135, 240.5) controlPoint1: NSMakePoint(120.9, 209) controlPoint2: NSMakePoint(135, 223.1)]; + [oval6Path closePath]; + [highlightStick setFill]; + [oval6Path fill]; + [darkController setStroke]; + [oval6Path setLineWidth: 2]; + [oval6Path stroke]; + } + + + //// But home Drawing + NSBezierPath* butHomePath = NSBezierPath.bezierPath; + [butHomePath moveToPoint: NSMakePoint(251.22, 234.1)]; + [butHomePath curveToPoint: NSMakePoint(232.47, 252.85) controlPoint1: NSMakePoint(251.22, 244.46) controlPoint2: NSMakePoint(242.82, 252.85)]; + [butHomePath curveToPoint: NSMakePoint(213.72, 234.1) controlPoint1: NSMakePoint(222.11, 252.85) controlPoint2: NSMakePoint(213.72, 244.46)]; + [butHomePath curveToPoint: NSMakePoint(232.47, 215.35) controlPoint1: NSMakePoint(213.72, 223.75) controlPoint2: NSMakePoint(222.11, 215.35)]; + [butHomePath curveToPoint: NSMakePoint(251.22, 234.1) controlPoint1: NSMakePoint(242.82, 215.35) controlPoint2: NSMakePoint(251.22, 223.75)]; + [butHomePath closePath]; + [homeColor setFill]; + [butHomePath fill]; + [homeStroke setStroke]; + [butHomePath setLineWidth: 2]; + [butHomePath stroke]; + + + //// But select + { + //// back Drawing + NSBezierPath* backPath = NSBezierPath.bezierPath; + [backPath moveToPoint: NSMakePoint(197.97, 234.85)]; + [backPath curveToPoint: NSMakePoint(188.93, 224.48) controlPoint1: NSMakePoint(197.97, 229.61) controlPoint2: NSMakePoint(194.05, 225.26)]; + [backPath curveToPoint: NSMakePoint(187.26, 224.35) controlPoint1: NSMakePoint(188.38, 224.4) controlPoint2: NSMakePoint(187.83, 224.35)]; + [backPath curveToPoint: NSMakePoint(183.93, 224.35) controlPoint1: NSMakePoint(187.26, 224.35) controlPoint2: NSMakePoint(184.49, 224.35)]; + [backPath curveToPoint: NSMakePoint(173.22, 234.85) controlPoint1: NSMakePoint(178.01, 224.35) controlPoint2: NSMakePoint(173.22, 229.05)]; + [backPath curveToPoint: NSMakePoint(183.93, 245.35) controlPoint1: NSMakePoint(173.22, 240.65) controlPoint2: NSMakePoint(178.01, 245.35)]; + [backPath curveToPoint: NSMakePoint(187.26, 245.35) controlPoint1: NSMakePoint(184.49, 245.35) controlPoint2: NSMakePoint(186.69, 245.35)]; + [backPath curveToPoint: NSMakePoint(197.97, 234.85) controlPoint1: NSMakePoint(193.17, 245.35) controlPoint2: NSMakePoint(197.97, 240.65)]; + [backPath closePath]; + [backColor setFill]; + [backPath fill]; + [backStroke setStroke]; + [backPath setLineWidth: 2]; + [backPath stroke]; + + + //// Rectangle Drawing + NSBezierPath* rectanglePath = NSBezierPath.bezierPath; + [rectanglePath moveToPoint: NSMakePoint(188.29, 239.65)]; + [rectanglePath lineToPoint: NSMakePoint(180.49, 234.85)]; + [rectanglePath lineToPoint: NSMakePoint(188.29, 230.05)]; + [rectanglePath lineToPoint: NSMakePoint(188.29, 239.65)]; + [rectanglePath closePath]; + [backStroke setFill]; + [rectanglePath fill]; + } + + + //// But start + { + //// start Drawing + NSBezierPath* startPath = NSBezierPath.bezierPath; + [startPath moveToPoint: NSMakePoint(290.15, 234.85)]; + [startPath curveToPoint: NSMakePoint(281.11, 224.48) controlPoint1: NSMakePoint(290.15, 229.61) controlPoint2: NSMakePoint(286.23, 225.26)]; + [startPath curveToPoint: NSMakePoint(279.44, 224.35) controlPoint1: NSMakePoint(280.57, 224.4) controlPoint2: NSMakePoint(280.01, 224.35)]; + [startPath curveToPoint: NSMakePoint(276.11, 224.35) controlPoint1: NSMakePoint(279.44, 224.35) controlPoint2: NSMakePoint(276.68, 224.35)]; + [startPath curveToPoint: NSMakePoint(265.4, 234.85) controlPoint1: NSMakePoint(270.2, 224.35) controlPoint2: NSMakePoint(265.4, 229.05)]; + [startPath curveToPoint: NSMakePoint(276.11, 245.35) controlPoint1: NSMakePoint(265.4, 240.65) controlPoint2: NSMakePoint(270.2, 245.35)]; + [startPath curveToPoint: NSMakePoint(279.44, 245.35) controlPoint1: NSMakePoint(276.68, 245.35) controlPoint2: NSMakePoint(278.88, 245.35)]; + [startPath curveToPoint: NSMakePoint(290.15, 234.85) controlPoint1: NSMakePoint(285.36, 245.35) controlPoint2: NSMakePoint(290.15, 240.65)]; + [startPath closePath]; + [startColor setFill]; + [startPath fill]; + [startStroke setStroke]; + [startPath setLineWidth: 2]; + [startPath stroke]; + + + //// Rectangle 2 Drawing + NSBezierPath* rectangle2Path = NSBezierPath.bezierPath; + [rectangle2Path moveToPoint: NSMakePoint(275.08, 230.05)]; + [rectangle2Path lineToPoint: NSMakePoint(282.88, 234.85)]; + [rectangle2Path lineToPoint: NSMakePoint(275.08, 239.65)]; + [rectangle2Path lineToPoint: NSMakePoint(275.08, 230.05)]; + [rectangle2Path closePath]; + [startStroke setFill]; + [rectangle2Path fill]; + } + + + //// But X + { + //// X Drawing + NSBezierPath* xPath = NSBezierPath.bezierPath; + [xPath moveToPoint: NSMakePoint(340.5, 236.75)]; + [xPath curveToPoint: NSMakePoint(324.75, 252.5) controlPoint1: NSMakePoint(340.5, 245.45) controlPoint2: NSMakePoint(333.45, 252.5)]; + [xPath curveToPoint: NSMakePoint(309, 236.75) controlPoint1: NSMakePoint(316.05, 252.5) controlPoint2: NSMakePoint(309, 245.45)]; + [xPath curveToPoint: NSMakePoint(324.75, 221) controlPoint1: NSMakePoint(309, 228.05) controlPoint2: NSMakePoint(316.05, 221)]; + [xPath curveToPoint: NSMakePoint(340.5, 236.75) controlPoint1: NSMakePoint(333.45, 221) controlPoint2: NSMakePoint(340.5, 228.05)]; + [xPath closePath]; + [xColor setFill]; + [xPath fill]; + [xStroke setStroke]; + [xPath setLineWidth: 3]; + [xPath stroke]; + + + //// Text Drawing + NSBezierPath* textPath = NSBezierPath.bezierPath; + [textPath moveToPoint: NSMakePoint(316.5, 244.8)]; + [textPath lineToPoint: NSMakePoint(321.98, 244.8)]; + [textPath lineToPoint: NSMakePoint(324.84, 239.85)]; + [textPath lineToPoint: NSMakePoint(327.61, 244.8)]; + [textPath lineToPoint: NSMakePoint(333.03, 244.8)]; + [textPath lineToPoint: NSMakePoint(328.02, 237)]; + [textPath lineToPoint: NSMakePoint(333.51, 228.7)]; + [textPath lineToPoint: NSMakePoint(327.91, 228.7)]; + [textPath lineToPoint: NSMakePoint(324.74, 233.87)]; + [textPath lineToPoint: NSMakePoint(321.55, 228.7)]; + [textPath lineToPoint: NSMakePoint(315.99, 228.7)]; + [textPath lineToPoint: NSMakePoint(321.55, 237.09)]; + [textPath lineToPoint: NSMakePoint(316.5, 244.8)]; + [textPath closePath]; + [xStroke setFill]; + [textPath fill]; + } + + + //// But B + { + //// B Drawing + NSBezierPath* bPath = NSBezierPath.bezierPath; + [bPath moveToPoint: NSMakePoint(407.5, 236.75)]; + [bPath curveToPoint: NSMakePoint(391.75, 252.5) controlPoint1: NSMakePoint(407.5, 245.45) controlPoint2: NSMakePoint(400.45, 252.5)]; + [bPath curveToPoint: NSMakePoint(376, 236.75) controlPoint1: NSMakePoint(383.05, 252.5) controlPoint2: NSMakePoint(376, 245.45)]; + [bPath curveToPoint: NSMakePoint(391.75, 221) controlPoint1: NSMakePoint(376, 228.05) controlPoint2: NSMakePoint(383.05, 221)]; + [bPath curveToPoint: NSMakePoint(407.5, 236.75) controlPoint1: NSMakePoint(400.45, 221) controlPoint2: NSMakePoint(407.5, 228.05)]; + [bPath closePath]; + [bColor setFill]; + [bPath fill]; + [bStroke setStroke]; + [bPath setLineWidth: 3]; + [bPath stroke]; + + + //// Text 3 Drawing + NSBezierPath* text3Path = NSBezierPath.bezierPath; + [text3Path moveToPoint: NSMakePoint(386.3, 243.73)]; + [text3Path lineToPoint: NSMakePoint(394.37, 243.73)]; + [text3Path curveToPoint: NSMakePoint(397.47, 242.73) controlPoint1: NSMakePoint(395.72, 243.73) controlPoint2: NSMakePoint(396.75, 243.4)]; + [text3Path curveToPoint: NSMakePoint(398.55, 240.25) controlPoint1: NSMakePoint(398.19, 242.06) controlPoint2: NSMakePoint(398.55, 241.24)]; + [text3Path curveToPoint: NSMakePoint(397.78, 238.13) controlPoint1: NSMakePoint(398.55, 239.43) controlPoint2: NSMakePoint(398.3, 238.72)]; + [text3Path curveToPoint: NSMakePoint(396.28, 237.2) controlPoint1: NSMakePoint(397.44, 237.74) controlPoint2: NSMakePoint(396.94, 237.43)]; + [text3Path curveToPoint: NSMakePoint(398.49, 235.95) controlPoint1: NSMakePoint(397.28, 236.96) controlPoint2: NSMakePoint(398.02, 236.54)]; + [text3Path curveToPoint: NSMakePoint(399.2, 233.74) controlPoint1: NSMakePoint(398.96, 235.37) controlPoint2: NSMakePoint(399.2, 234.63)]; + [text3Path curveToPoint: NSMakePoint(398.7, 231.79) controlPoint1: NSMakePoint(399.2, 233.02) controlPoint2: NSMakePoint(399.03, 232.37)]; + [text3Path curveToPoint: NSMakePoint(397.32, 230.42) controlPoint1: NSMakePoint(398.36, 231.21) controlPoint2: NSMakePoint(397.9, 230.75)]; + [text3Path curveToPoint: NSMakePoint(395.68, 229.96) controlPoint1: NSMakePoint(396.95, 230.21) controlPoint2: NSMakePoint(396.41, 230.06)]; + [text3Path curveToPoint: NSMakePoint(393.74, 229.77) controlPoint1: NSMakePoint(394.71, 229.83) controlPoint2: NSMakePoint(394.06, 229.77)]; + [text3Path lineToPoint: NSMakePoint(386.3, 229.77)]; + [text3Path lineToPoint: NSMakePoint(386.3, 243.73)]; + [text3Path closePath]; + [text3Path moveToPoint: NSMakePoint(390.65, 238.25)]; + [text3Path lineToPoint: NSMakePoint(392.53, 238.25)]; + [text3Path curveToPoint: NSMakePoint(393.93, 238.6) controlPoint1: NSMakePoint(393.2, 238.25) controlPoint2: NSMakePoint(393.67, 238.37)]; + [text3Path curveToPoint: NSMakePoint(394.33, 239.61) controlPoint1: NSMakePoint(394.19, 238.83) controlPoint2: NSMakePoint(394.33, 239.17)]; + [text3Path curveToPoint: NSMakePoint(393.93, 240.56) controlPoint1: NSMakePoint(394.33, 240.01) controlPoint2: NSMakePoint(394.19, 240.33)]; + [text3Path curveToPoint: NSMakePoint(392.55, 240.9) controlPoint1: NSMakePoint(393.67, 240.79) controlPoint2: NSMakePoint(393.21, 240.9)]; + [text3Path lineToPoint: NSMakePoint(390.65, 240.9)]; + [text3Path lineToPoint: NSMakePoint(390.65, 238.25)]; + [text3Path closePath]; + [text3Path moveToPoint: NSMakePoint(390.65, 232.77)]; + [text3Path lineToPoint: NSMakePoint(392.85, 232.77)]; + [text3Path curveToPoint: NSMakePoint(394.42, 233.17) controlPoint1: NSMakePoint(393.59, 232.77) controlPoint2: NSMakePoint(394.12, 232.9)]; + [text3Path curveToPoint: NSMakePoint(394.88, 234.23) controlPoint1: NSMakePoint(394.73, 233.43) controlPoint2: NSMakePoint(394.88, 233.78)]; + [text3Path curveToPoint: NSMakePoint(394.43, 235.22) controlPoint1: NSMakePoint(394.88, 234.64) controlPoint2: NSMakePoint(394.73, 234.97)]; + [text3Path curveToPoint: NSMakePoint(392.84, 235.6) controlPoint1: NSMakePoint(394.12, 235.47) controlPoint2: NSMakePoint(393.6, 235.6)]; + [text3Path lineToPoint: NSMakePoint(390.65, 235.6)]; + [text3Path lineToPoint: NSMakePoint(390.65, 232.77)]; + [text3Path closePath]; + [bStroke setFill]; + [text3Path fill]; + } + + + //// But Y + { + //// Y Drawing + NSBezierPath* yPath = NSBezierPath.bezierPath; + [yPath moveToPoint: NSMakePoint(375, 272)]; + [yPath curveToPoint: NSMakePoint(359, 288) controlPoint1: NSMakePoint(375, 280.84) controlPoint2: NSMakePoint(367.84, 288)]; + [yPath curveToPoint: NSMakePoint(343, 272) controlPoint1: NSMakePoint(350.16, 288) controlPoint2: NSMakePoint(343, 280.84)]; + [yPath curveToPoint: NSMakePoint(359, 256) controlPoint1: NSMakePoint(343, 263.16) controlPoint2: NSMakePoint(350.16, 256)]; + [yPath curveToPoint: NSMakePoint(375, 272) controlPoint1: NSMakePoint(367.84, 256) controlPoint2: NSMakePoint(375, 263.16)]; + [yPath closePath]; + [yColor setFill]; + [yPath fill]; + [yStroke setStroke]; + [yPath setLineWidth: 3]; + [yPath stroke]; + + + //// Text 4 Drawing + NSBezierPath* text4Path = NSBezierPath.bezierPath; + [text4Path moveToPoint: NSMakePoint(351.4, 277.98)]; + [text4Path lineToPoint: NSMakePoint(356.19, 277.98)]; + [text4Path lineToPoint: NSMakePoint(359.01, 273.27)]; + [text4Path lineToPoint: NSMakePoint(361.83, 277.98)]; + [text4Path lineToPoint: NSMakePoint(366.59, 277.98)]; + [text4Path lineToPoint: NSMakePoint(361.16, 269.87)]; + [text4Path lineToPoint: NSMakePoint(361.16, 264.02)]; + [text4Path lineToPoint: NSMakePoint(356.84, 264.02)]; + [text4Path lineToPoint: NSMakePoint(356.84, 269.87)]; + [text4Path lineToPoint: NSMakePoint(351.4, 277.98)]; + [text4Path closePath]; + [yStroke setFill]; + [text4Path fill]; + } + + + //// But A + { + //// A Drawing + NSBezierPath* aPath = NSBezierPath.bezierPath; + [aPath moveToPoint: NSMakePoint(375, 203)]; + [aPath curveToPoint: NSMakePoint(359, 219) controlPoint1: NSMakePoint(375, 211.84) controlPoint2: NSMakePoint(367.84, 219)]; + [aPath curveToPoint: NSMakePoint(343, 203) controlPoint1: NSMakePoint(350.16, 219) controlPoint2: NSMakePoint(343, 211.84)]; + [aPath curveToPoint: NSMakePoint(359, 187) controlPoint1: NSMakePoint(343, 194.16) controlPoint2: NSMakePoint(350.16, 187)]; + [aPath curveToPoint: NSMakePoint(375, 203) controlPoint1: NSMakePoint(367.84, 187) controlPoint2: NSMakePoint(375, 194.16)]; + [aPath closePath]; + [aColor setFill]; + [aPath fill]; + [aStroke setStroke]; + [aPath setLineWidth: 3]; + [aPath stroke]; + + + //// Text 2 Drawing + NSBezierPath* text2Path = NSBezierPath.bezierPath; + [text2Path moveToPoint: NSMakePoint(361.4, 199.32)]; + [text2Path lineToPoint: NSMakePoint(356.49, 199.32)]; + [text2Path lineToPoint: NSMakePoint(355.81, 197.02)]; + [text2Path lineToPoint: NSMakePoint(351.4, 197.02)]; + [text2Path lineToPoint: NSMakePoint(356.65, 210.98)]; + [text2Path lineToPoint: NSMakePoint(361.35, 210.98)]; + [text2Path lineToPoint: NSMakePoint(366.6, 197.02)]; + [text2Path lineToPoint: NSMakePoint(362.08, 197.02)]; + [text2Path lineToPoint: NSMakePoint(361.4, 199.32)]; + [text2Path closePath]; + [text2Path moveToPoint: NSMakePoint(360.49, 202.34)]; + [text2Path lineToPoint: NSMakePoint(358.95, 207.36)]; + [text2Path lineToPoint: NSMakePoint(357.42, 202.34)]; + [text2Path lineToPoint: NSMakePoint(360.49, 202.34)]; + [text2Path closePath]; + [aStroke setFill]; + [text2Path fill]; + } + + + //// DigiCross + { + //// Oval 3 Drawing + NSBezierPath* oval3Path = NSBezierPath.bezierPath; + [oval3Path moveToPoint: NSMakePoint(204, 162.5)]; + [oval3Path curveToPoint: NSMakePoint(165.5, 201) controlPoint1: NSMakePoint(204, 183.76) controlPoint2: NSMakePoint(186.76, 201)]; + [oval3Path curveToPoint: NSMakePoint(127, 162.5) controlPoint1: NSMakePoint(144.24, 201) controlPoint2: NSMakePoint(127, 183.76)]; + [oval3Path curveToPoint: NSMakePoint(165.5, 124) controlPoint1: NSMakePoint(127, 141.24) controlPoint2: NSMakePoint(144.24, 124)]; + [oval3Path curveToPoint: NSMakePoint(204, 162.5) controlPoint1: NSMakePoint(186.76, 124) controlPoint2: NSMakePoint(204, 141.24)]; + [oval3Path closePath]; + [darkController setFill]; + [oval3Path fill]; + + + //// Oval 5 Drawing + NSBezierPath* oval5Path = NSBezierPath.bezierPath; + [oval5Path moveToPoint: NSMakePoint(201, 162.5)]; + [oval5Path curveToPoint: NSMakePoint(165.5, 198) controlPoint1: NSMakePoint(201, 182.11) controlPoint2: NSMakePoint(185.11, 198)]; + [oval5Path curveToPoint: NSMakePoint(130, 162.5) controlPoint1: NSMakePoint(145.89, 198) controlPoint2: NSMakePoint(130, 182.11)]; + [oval5Path curveToPoint: NSMakePoint(165.5, 127) controlPoint1: NSMakePoint(130, 142.89) controlPoint2: NSMakePoint(145.89, 127)]; + [oval5Path curveToPoint: NSMakePoint(201, 162.5) controlPoint1: NSMakePoint(185.11, 127) controlPoint2: NSMakePoint(201, 142.89)]; + [oval5Path closePath]; + [cross setFill]; + [oval5Path fill]; + [crossStroke setStroke]; + [oval5Path setLineWidth: 1]; + [oval5Path stroke]; + + + //// Bezier 5 Drawing + NSBezierPath* bezier5Path = NSBezierPath.bezierPath; + [bezier5Path moveToPoint: NSMakePoint(176.59, 196.23)]; + [bezier5Path curveToPoint: NSMakePoint(177.55, 184.69) controlPoint1: NSMakePoint(176.63, 194.6) controlPoint2: NSMakePoint(176.83, 189.18)]; + [bezier5Path curveToPoint: NSMakePoint(186.12, 174.48) controlPoint1: NSMakePoint(178.4, 179.35) controlPoint2: NSMakePoint(182.37, 175.72)]; + [bezier5Path curveToPoint: NSMakePoint(199.27, 173.48) controlPoint1: NSMakePoint(189.42, 173.38) controlPoint2: NSMakePoint(197.38, 173.45)]; + [bezier5Path curveToPoint: NSMakePoint(201, 162.5) controlPoint1: NSMakePoint(200.39, 170.02) controlPoint2: NSMakePoint(201, 166.33)]; + [bezier5Path curveToPoint: NSMakePoint(199.18, 151.26) controlPoint1: NSMakePoint(201, 158.57) controlPoint2: NSMakePoint(200.36, 154.79)]; + [bezier5Path curveToPoint: NSMakePoint(187.54, 150.3) controlPoint1: NSMakePoint(197.69, 151.22) controlPoint2: NSMakePoint(192.12, 151.03)]; + [bezier5Path curveToPoint: NSMakePoint(177.32, 141.72) controlPoint1: NSMakePoint(182.19, 149.44) controlPoint2: NSMakePoint(178.56, 145.47)]; + [bezier5Path curveToPoint: NSMakePoint(176.32, 128.68) controlPoint1: NSMakePoint(176.25, 138.48) controlPoint2: NSMakePoint(176.29, 130.75)]; + [bezier5Path curveToPoint: NSMakePoint(165.5, 127) controlPoint1: NSMakePoint(172.91, 127.59) controlPoint2: NSMakePoint(169.27, 127)]; + [bezier5Path curveToPoint: NSMakePoint(157.66, 127.87) controlPoint1: NSMakePoint(162.81, 127) controlPoint2: NSMakePoint(160.18, 127.3)]; + [bezier5Path curveToPoint: NSMakePoint(154.1, 128.87) controlPoint1: NSMakePoint(156.45, 128.14) controlPoint2: NSMakePoint(155.26, 128.48)]; + [bezier5Path curveToPoint: NSMakePoint(153.14, 140.31) controlPoint1: NSMakePoint(154.05, 130.62) controlPoint2: NSMakePoint(153.84, 135.92)]; + [bezier5Path curveToPoint: NSMakePoint(144.56, 150.52) controlPoint1: NSMakePoint(152.28, 145.65) controlPoint2: NSMakePoint(148.32, 149.28)]; + [bezier5Path curveToPoint: NSMakePoint(135.99, 151.49) controlPoint1: NSMakePoint(142.6, 151.17) controlPoint2: NSMakePoint(138.99, 151.41)]; + [bezier5Path curveToPoint: NSMakePoint(131.73, 151.52) controlPoint1: NSMakePoint(134.19, 151.54) controlPoint2: NSMakePoint(132.6, 151.54)]; + [bezier5Path curveToPoint: NSMakePoint(130, 162.5) controlPoint1: NSMakePoint(130.61, 154.98) controlPoint2: NSMakePoint(130, 158.67)]; + [bezier5Path curveToPoint: NSMakePoint(131.82, 173.75) controlPoint1: NSMakePoint(130, 166.43) controlPoint2: NSMakePoint(130.64, 170.21)]; + [bezier5Path curveToPoint: NSMakePoint(136.02, 173.95) controlPoint1: NSMakePoint(132.66, 173.77) controlPoint2: NSMakePoint(134.19, 173.83)]; + [bezier5Path curveToPoint: NSMakePoint(143.15, 174.7) controlPoint1: NSMakePoint(138.2, 174.09) controlPoint2: NSMakePoint(140.8, 174.33)]; + [bezier5Path curveToPoint: NSMakePoint(153.37, 183.28) controlPoint1: NSMakePoint(148.5, 175.56) controlPoint2: NSMakePoint(152.12, 179.53)]; + [bezier5Path curveToPoint: NSMakePoint(154.37, 196.22) controlPoint1: NSMakePoint(154.42, 186.47) controlPoint2: NSMakePoint(154.4, 194.01)]; + [bezier5Path curveToPoint: NSMakePoint(165.5, 198) controlPoint1: NSMakePoint(157.87, 197.37) controlPoint2: NSMakePoint(161.61, 198)]; + [bezier5Path curveToPoint: NSMakePoint(176.59, 196.23) controlPoint1: NSMakePoint(169.37, 198) controlPoint2: NSMakePoint(173.1, 197.38)]; + [bezier5Path closePath]; + [cross setFill]; + [bezier5Path fill]; + [crossStroke setStroke]; + [bezier5Path setLineWidth: 1]; + [bezier5Path stroke]; + + + if (downPressed) + { + //// D + { + //// down Drawing + NSBezierPath* downPath = NSBezierPath.bezierPath; + [downPath moveToPoint: NSMakePoint(181.16, 147.34)]; + [downPath curveToPoint: NSMakePoint(177.32, 141.72) controlPoint1: NSMakePoint(179.29, 145.73) controlPoint2: NSMakePoint(177.97, 143.69)]; + [downPath curveToPoint: NSMakePoint(176.32, 128.68) controlPoint1: NSMakePoint(176.25, 138.48) controlPoint2: NSMakePoint(176.29, 130.75)]; + [downPath curveToPoint: NSMakePoint(165.5, 127) controlPoint1: NSMakePoint(172.91, 127.59) controlPoint2: NSMakePoint(169.27, 127)]; + [downPath curveToPoint: NSMakePoint(157.66, 127.87) controlPoint1: NSMakePoint(162.81, 127) controlPoint2: NSMakePoint(160.18, 127.3)]; + [downPath curveToPoint: NSMakePoint(154.1, 128.87) controlPoint1: NSMakePoint(156.45, 128.14) controlPoint2: NSMakePoint(155.26, 128.48)]; + [downPath curveToPoint: NSMakePoint(153.14, 140.31) controlPoint1: NSMakePoint(154.05, 130.62) controlPoint2: NSMakePoint(153.84, 135.92)]; + [downPath curveToPoint: NSMakePoint(149.7, 147.2) controlPoint1: NSMakePoint(152.69, 143.11) controlPoint2: NSMakePoint(151.39, 145.44)]; + [downPath curveToPoint: NSMakePoint(165.5, 163) controlPoint1: NSMakePoint(158.26, 155.76) controlPoint2: NSMakePoint(165.5, 163)]; + [downPath curveToPoint: NSMakePoint(181.16, 147.34) controlPoint1: NSMakePoint(165.5, 163) controlPoint2: NSMakePoint(172.67, 155.83)]; + [downPath closePath]; + [pressed setFill]; + [downPath fill]; + + + //// down 2 Drawing + NSBezierPath* down2Path = NSBezierPath.bezierPath; + [down2Path moveToPoint: NSMakePoint(181.16, 147.34)]; + [down2Path curveToPoint: NSMakePoint(177.32, 141.72) controlPoint1: NSMakePoint(179.29, 145.73) controlPoint2: NSMakePoint(177.97, 143.69)]; + [down2Path curveToPoint: NSMakePoint(176.32, 128.68) controlPoint1: NSMakePoint(176.25, 138.48) controlPoint2: NSMakePoint(176.29, 130.75)]; + [down2Path curveToPoint: NSMakePoint(165.5, 127) controlPoint1: NSMakePoint(172.91, 127.59) controlPoint2: NSMakePoint(169.27, 127)]; + [down2Path curveToPoint: NSMakePoint(157.66, 127.87) controlPoint1: NSMakePoint(162.81, 127) controlPoint2: NSMakePoint(160.18, 127.3)]; + [down2Path curveToPoint: NSMakePoint(154.1, 128.87) controlPoint1: NSMakePoint(156.45, 128.14) controlPoint2: NSMakePoint(155.26, 128.48)]; + [down2Path curveToPoint: NSMakePoint(153.14, 140.31) controlPoint1: NSMakePoint(154.05, 130.62) controlPoint2: NSMakePoint(153.84, 135.92)]; + [down2Path curveToPoint: NSMakePoint(149.7, 147.2) controlPoint1: NSMakePoint(152.69, 143.11) controlPoint2: NSMakePoint(151.39, 145.44)]; + [pressedStroke setStroke]; + [down2Path setLineWidth: 1]; + [down2Path stroke]; + } + } + + + if (rightPressed) + { + //// R + { + //// right Drawing + NSBezierPath* rightPath = NSBezierPath.bezierPath; + [rightPath moveToPoint: NSMakePoint(186.12, 174.48)]; + [rightPath curveToPoint: NSMakePoint(199.27, 173.48) controlPoint1: NSMakePoint(189.42, 173.38) controlPoint2: NSMakePoint(197.38, 173.45)]; + [rightPath curveToPoint: NSMakePoint(201, 162.5) controlPoint1: NSMakePoint(200.39, 170.02) controlPoint2: NSMakePoint(201, 166.33)]; + [rightPath curveToPoint: NSMakePoint(199.18, 151.26) controlPoint1: NSMakePoint(201, 158.57) controlPoint2: NSMakePoint(200.36, 154.79)]; + [rightPath curveToPoint: NSMakePoint(187.54, 150.3) controlPoint1: NSMakePoint(197.69, 151.22) controlPoint2: NSMakePoint(192.12, 151.03)]; + [rightPath curveToPoint: NSMakePoint(180.64, 146.86) controlPoint1: NSMakePoint(184.73, 149.85) controlPoint2: NSMakePoint(182.4, 148.54)]; + [rightPath curveToPoint: NSMakePoint(165, 162.5) controlPoint1: NSMakePoint(172.16, 155.34) controlPoint2: NSMakePoint(165, 162.5)]; + [rightPath curveToPoint: NSMakePoint(180.65, 178.15) controlPoint1: NSMakePoint(165, 162.5) controlPoint2: NSMakePoint(172.16, 169.66)]; + [rightPath curveToPoint: NSMakePoint(186.12, 174.48) controlPoint1: NSMakePoint(182.24, 176.37) controlPoint2: NSMakePoint(184.21, 175.11)]; + [rightPath closePath]; + [pressed setFill]; + [rightPath fill]; + + + //// right 2 Drawing + NSBezierPath* right2Path = NSBezierPath.bezierPath; + [right2Path moveToPoint: NSMakePoint(180.65, 178.15)]; + [right2Path curveToPoint: NSMakePoint(186.12, 174.48) controlPoint1: NSMakePoint(182.24, 176.37) controlPoint2: NSMakePoint(184.21, 175.11)]; + [right2Path curveToPoint: NSMakePoint(199.27, 173.48) controlPoint1: NSMakePoint(189.42, 173.38) controlPoint2: NSMakePoint(197.38, 173.45)]; + [right2Path curveToPoint: NSMakePoint(201, 162.5) controlPoint1: NSMakePoint(200.39, 170.02) controlPoint2: NSMakePoint(201, 166.33)]; + [right2Path curveToPoint: NSMakePoint(199.18, 151.26) controlPoint1: NSMakePoint(201, 158.57) controlPoint2: NSMakePoint(200.36, 154.79)]; + [right2Path curveToPoint: NSMakePoint(187.54, 150.3) controlPoint1: NSMakePoint(197.69, 151.22) controlPoint2: NSMakePoint(192.12, 151.03)]; + [right2Path curveToPoint: NSMakePoint(180.64, 146.86) controlPoint1: NSMakePoint(184.73, 149.85) controlPoint2: NSMakePoint(182.4, 148.54)]; + [pressedStroke setStroke]; + [right2Path setLineWidth: 1]; + [right2Path stroke]; + } + } + + + if (upPressed) + { + //// U + { + //// up Drawing + NSBezierPath* upPath = NSBezierPath.bezierPath; + [upPath moveToPoint: NSMakePoint(176.59, 196.23)]; + [upPath curveToPoint: NSMakePoint(177.55, 184.69) controlPoint1: NSMakePoint(176.63, 194.6) controlPoint2: NSMakePoint(176.83, 189.18)]; + [upPath curveToPoint: NSMakePoint(181.14, 177.64) controlPoint1: NSMakePoint(178.01, 181.8) controlPoint2: NSMakePoint(179.38, 179.42)]; + [upPath curveToPoint: NSMakePoint(165.5, 162) controlPoint1: NSMakePoint(172.65, 169.15) controlPoint2: NSMakePoint(165.5, 162)]; + [upPath curveToPoint: NSMakePoint(149.69, 177.81) controlPoint1: NSMakePoint(165.5, 162) controlPoint2: NSMakePoint(158.25, 169.25)]; + [upPath curveToPoint: NSMakePoint(153.37, 183.28) controlPoint1: NSMakePoint(151.48, 179.39) controlPoint2: NSMakePoint(152.73, 181.37)]; + [upPath curveToPoint: NSMakePoint(154.37, 196.22) controlPoint1: NSMakePoint(154.42, 186.47) controlPoint2: NSMakePoint(154.4, 194.01)]; + [upPath curveToPoint: NSMakePoint(165.5, 198) controlPoint1: NSMakePoint(157.87, 197.37) controlPoint2: NSMakePoint(161.61, 198)]; + [upPath curveToPoint: NSMakePoint(176.59, 196.23) controlPoint1: NSMakePoint(169.37, 198) controlPoint2: NSMakePoint(173.1, 197.38)]; + [upPath closePath]; + [pressed setFill]; + [upPath fill]; + + + //// up 2 Drawing + NSBezierPath* up2Path = NSBezierPath.bezierPath; + [up2Path moveToPoint: NSMakePoint(149.69, 177.81)]; + [up2Path curveToPoint: NSMakePoint(153.37, 183.28) controlPoint1: NSMakePoint(151.48, 179.39) controlPoint2: NSMakePoint(152.73, 181.37)]; + [up2Path curveToPoint: NSMakePoint(154.37, 196.22) controlPoint1: NSMakePoint(154.42, 186.47) controlPoint2: NSMakePoint(154.4, 194.01)]; + [up2Path curveToPoint: NSMakePoint(165.5, 198) controlPoint1: NSMakePoint(157.87, 197.37) controlPoint2: NSMakePoint(161.61, 198)]; + [up2Path curveToPoint: NSMakePoint(176.59, 196.23) controlPoint1: NSMakePoint(169.37, 198) controlPoint2: NSMakePoint(173.1, 197.38)]; + [up2Path curveToPoint: NSMakePoint(177.55, 184.69) controlPoint1: NSMakePoint(176.63, 194.6) controlPoint2: NSMakePoint(176.83, 189.18)]; + [up2Path curveToPoint: NSMakePoint(181.14, 177.64) controlPoint1: NSMakePoint(178.01, 181.8) controlPoint2: NSMakePoint(179.38, 179.42)]; + [pressedStroke setStroke]; + [up2Path setLineWidth: 1]; + [up2Path stroke]; + } + } + + + if (leftPressed) + { + //// L + { + //// left Drawing + NSBezierPath* leftPath = NSBezierPath.bezierPath; + [leftPath moveToPoint: NSMakePoint(150.18, 146.68)]; + [leftPath curveToPoint: NSMakePoint(144.56, 150.52) controlPoint1: NSMakePoint(148.57, 148.56) controlPoint2: NSMakePoint(146.54, 149.87)]; + [leftPath lineToPoint: NSMakePoint(144.42, 150.57)]; + [leftPath curveToPoint: NSMakePoint(135.99, 151.49) controlPoint1: NSMakePoint(142.43, 151.18) controlPoint2: NSMakePoint(138.92, 151.42)]; + [leftPath curveToPoint: NSMakePoint(131.73, 151.52) controlPoint1: NSMakePoint(134.19, 151.54) controlPoint2: NSMakePoint(132.6, 151.54)]; + [leftPath curveToPoint: NSMakePoint(130, 162.5) controlPoint1: NSMakePoint(130.61, 154.98) controlPoint2: NSMakePoint(130, 158.67)]; + [leftPath curveToPoint: NSMakePoint(131.82, 173.75) controlPoint1: NSMakePoint(130, 166.43) controlPoint2: NSMakePoint(130.64, 170.21)]; + [leftPath curveToPoint: NSMakePoint(136.02, 173.95) controlPoint1: NSMakePoint(132.66, 173.77) controlPoint2: NSMakePoint(134.19, 173.83)]; + [leftPath curveToPoint: NSMakePoint(143.15, 174.7) controlPoint1: NSMakePoint(138.2, 174.09) controlPoint2: NSMakePoint(140.8, 174.33)]; + [leftPath curveToPoint: NSMakePoint(150.21, 178.29) controlPoint1: NSMakePoint(146.04, 175.17) controlPoint2: NSMakePoint(148.43, 176.54)]; + [leftPath curveToPoint: NSMakePoint(166, 162.5) controlPoint1: NSMakePoint(158.76, 169.74) controlPoint2: NSMakePoint(166, 162.5)]; + [leftPath curveToPoint: NSMakePoint(150.18, 146.68) controlPoint1: NSMakePoint(166, 162.5) controlPoint2: NSMakePoint(158.74, 155.24)]; + [leftPath closePath]; + [pressed setFill]; + [leftPath fill]; + + + //// left 2 Drawing + NSBezierPath* left2Path = NSBezierPath.bezierPath; + [left2Path moveToPoint: NSMakePoint(150.18, 146.68)]; + [left2Path curveToPoint: NSMakePoint(144.56, 150.52) controlPoint1: NSMakePoint(148.57, 148.56) controlPoint2: NSMakePoint(146.54, 149.87)]; + [left2Path lineToPoint: NSMakePoint(144.42, 150.57)]; + [left2Path curveToPoint: NSMakePoint(135.99, 151.49) controlPoint1: NSMakePoint(142.43, 151.18) controlPoint2: NSMakePoint(138.92, 151.42)]; + [left2Path curveToPoint: NSMakePoint(131.73, 151.52) controlPoint1: NSMakePoint(134.19, 151.54) controlPoint2: NSMakePoint(132.6, 151.54)]; + [left2Path curveToPoint: NSMakePoint(130, 162.5) controlPoint1: NSMakePoint(130.61, 154.98) controlPoint2: NSMakePoint(130, 158.67)]; + [left2Path curveToPoint: NSMakePoint(131.82, 173.75) controlPoint1: NSMakePoint(130, 166.43) controlPoint2: NSMakePoint(130.64, 170.21)]; + [left2Path curveToPoint: NSMakePoint(136.02, 173.95) controlPoint1: NSMakePoint(132.66, 173.77) controlPoint2: NSMakePoint(134.19, 173.83)]; + [left2Path curveToPoint: NSMakePoint(143.15, 174.7) controlPoint1: NSMakePoint(138.2, 174.09) controlPoint2: NSMakePoint(140.8, 174.33)]; + [left2Path curveToPoint: NSMakePoint(150.21, 178.29) controlPoint1: NSMakePoint(146.04, 175.17) controlPoint2: NSMakePoint(148.43, 176.54)]; + [pressedStroke setStroke]; + [left2Path setLineWidth: 1]; + [left2Path stroke]; + } + } + } + + + //// stickRight + { + if (rightNormalized) + { + CGFloat rightDead = rightDeadzone * 15; + const CGFloat max16 = 15; + CGFloat maxVal = max16 - rightDead; + + if (rightStickPosition.x > 0) + rightStickPosition.x = (fabs(rightStickPosition.x) * maxVal / max16) + rightDead; + else if (rightStickPosition.x < 0) + rightStickPosition.x = -((fabs(rightStickPosition.x) * maxVal / max16) + rightDead); + else + rightStickPosition.x = 0; + + if (rightStickPosition.y > 0) + rightStickPosition.y = (fabs(rightStickPosition.y) * maxVal / max16) + rightDead; + else if (rightStickPosition.y < 0) + rightStickPosition.y = -((fabs(rightStickPosition.y) * maxVal / max16) + rightDead); + else + rightStickPosition.y = 0; + } + [NSGraphicsContext saveGraphicsState]; + CGContextTranslateCTM(context, (rightStickPosition.x + 263), (rightStickPosition.y + 133)); + + + + //// knobRight + { + //// Oval 9 Drawing + NSBezierPath* oval9Path = NSBezierPath.bezierPath; + [oval9Path moveToPoint: NSMakePoint(61, 30.5)]; + [oval9Path curveToPoint: NSMakePoint(30.5, 61) controlPoint1: NSMakePoint(61, 47.34) controlPoint2: NSMakePoint(47.34, 61)]; + [oval9Path curveToPoint: NSMakePoint(0, 30.5) controlPoint1: NSMakePoint(13.66, 61) controlPoint2: NSMakePoint(0, 47.34)]; + [oval9Path curveToPoint: NSMakePoint(30.5, 0) controlPoint1: NSMakePoint(0, 13.66) controlPoint2: NSMakePoint(13.66, 0)]; + [oval9Path curveToPoint: NSMakePoint(61, 30.5) controlPoint1: NSMakePoint(47.34, 0) controlPoint2: NSMakePoint(61, 13.66)]; + [oval9Path closePath]; + [rightStickColor setFill]; + [oval9Path fill]; + [rightStickStroke setStroke]; + [oval9Path setLineWidth: 2]; + [oval9Path stroke]; + + + //// Oval 14 Drawing + NSBezierPath* oval14Path = NSBezierPath.bezierPath; + [oval14Path moveToPoint: NSMakePoint(32.03, 48.8)]; + [oval14Path curveToPoint: NSMakePoint(30.5, 50.33) controlPoint1: NSMakePoint(32.03, 49.64) controlPoint2: NSMakePoint(31.34, 50.33)]; + [oval14Path curveToPoint: NSMakePoint(28.98, 48.8) controlPoint1: NSMakePoint(29.66, 50.33) controlPoint2: NSMakePoint(28.98, 49.64)]; + [oval14Path curveToPoint: NSMakePoint(30.5, 47.27) controlPoint1: NSMakePoint(28.98, 47.96) controlPoint2: NSMakePoint(29.66, 47.27)]; + [oval14Path curveToPoint: NSMakePoint(32.03, 48.8) controlPoint1: NSMakePoint(31.34, 47.27) controlPoint2: NSMakePoint(32.03, 47.96)]; + [oval14Path closePath]; + [NSColor.grayColor setFill]; + [oval14Path fill]; + + + //// Oval 15 Drawing + NSBezierPath* oval15Path = NSBezierPath.bezierPath; + [oval15Path moveToPoint: NSMakePoint(13.73, 30.5)]; + [oval15Path curveToPoint: NSMakePoint(12.2, 32.02) controlPoint1: NSMakePoint(13.73, 31.34) controlPoint2: NSMakePoint(13.04, 32.02)]; + [oval15Path curveToPoint: NSMakePoint(10.68, 30.5) controlPoint1: NSMakePoint(11.36, 32.02) controlPoint2: NSMakePoint(10.68, 31.34)]; + [oval15Path curveToPoint: NSMakePoint(12.2, 28.98) controlPoint1: NSMakePoint(10.68, 29.66) controlPoint2: NSMakePoint(11.36, 28.98)]; + [oval15Path curveToPoint: NSMakePoint(13.73, 30.5) controlPoint1: NSMakePoint(13.04, 28.98) controlPoint2: NSMakePoint(13.73, 29.66)]; + [oval15Path closePath]; + [NSColor.grayColor setFill]; + [oval15Path fill]; + + + //// Oval 16 Drawing + NSBezierPath* oval16Path = NSBezierPath.bezierPath; + [oval16Path moveToPoint: NSMakePoint(50.32, 30.5)]; + [oval16Path curveToPoint: NSMakePoint(48.8, 32.02) controlPoint1: NSMakePoint(50.32, 31.34) controlPoint2: NSMakePoint(49.64, 32.02)]; + [oval16Path curveToPoint: NSMakePoint(47.27, 30.5) controlPoint1: NSMakePoint(47.96, 32.02) controlPoint2: NSMakePoint(47.27, 31.34)]; + [oval16Path curveToPoint: NSMakePoint(48.8, 28.98) controlPoint1: NSMakePoint(47.27, 29.66) controlPoint2: NSMakePoint(47.96, 28.98)]; + [oval16Path curveToPoint: NSMakePoint(50.32, 30.5) controlPoint1: NSMakePoint(49.64, 28.98) controlPoint2: NSMakePoint(50.32, 29.66)]; + [oval16Path closePath]; + [NSColor.grayColor setFill]; + [oval16Path fill]; + + + //// Oval 17 Drawing + NSBezierPath* oval17Path = NSBezierPath.bezierPath; + [oval17Path moveToPoint: NSMakePoint(32.03, 12.2)]; + [oval17Path curveToPoint: NSMakePoint(30.5, 13.72) controlPoint1: NSMakePoint(32.03, 13.04) controlPoint2: NSMakePoint(31.34, 13.72)]; + [oval17Path curveToPoint: NSMakePoint(28.98, 12.2) controlPoint1: NSMakePoint(29.66, 13.72) controlPoint2: NSMakePoint(28.98, 13.04)]; + [oval17Path curveToPoint: NSMakePoint(30.5, 10.68) controlPoint1: NSMakePoint(28.98, 11.36) controlPoint2: NSMakePoint(29.66, 10.68)]; + [oval17Path curveToPoint: NSMakePoint(32.03, 12.2) controlPoint1: NSMakePoint(31.34, 10.68) controlPoint2: NSMakePoint(32.03, 11.36)]; + [oval17Path closePath]; + [NSColor.grayColor setFill]; + [oval17Path fill]; + + + //// Oval 19 Drawing + NSBezierPath* oval19Path = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect(2, 2, 57, 57)]; + [NSGraphicsContext saveGraphicsState]; + [oval19Path addClip]; + [gradient drawFromCenter: NSMakePoint(30.5, 30.5) radius: 4.02 + toCenter: NSMakePoint(30.5, 30.5) radius: 26.54 + options: NSGradientDrawsBeforeStartingLocation | NSGradientDrawsAfterEndingLocation]; + [NSGraphicsContext restoreGraphicsState]; + } + + + + [NSGraphicsContext restoreGraphicsState]; + } + + + //// stickLeft + { + if (leftNormalized) + { + CGFloat leftDead = leftDeadzone * 15; + const CGFloat max16 = 15; + CGFloat maxVal = max16 - leftDead; + + if (leftStickPosition.x > 0) + leftStickPosition.x = (fabs(leftStickPosition.x) * maxVal / max16) + leftDead; + else if (leftStickPosition.x < 0) + leftStickPosition.x = -((fabs(leftStickPosition.x) * maxVal / max16) + leftDead); + else + leftStickPosition.x = 0; + + if (leftStickPosition.y > 0) + leftStickPosition.y = (fabs(leftStickPosition.y) * maxVal / max16) + leftDead; + else if (leftStickPosition.y < 0) + leftStickPosition.y = -((fabs(leftStickPosition.y) * maxVal / max16) + leftDead); + else + leftStickPosition.y = 0; + } + [NSGraphicsContext saveGraphicsState]; + CGContextTranslateCTM(context, (leftStickPosition.x + 104), (leftStickPosition.y + 240)); + + + + //// knobLeft + { + //// Oval 7 Drawing + NSBezierPath* oval7Path = NSBezierPath.bezierPath; + [oval7Path moveToPoint: NSMakePoint(30, 0.5)]; + [oval7Path curveToPoint: NSMakePoint(-0.5, 31) controlPoint1: NSMakePoint(30, 17.34) controlPoint2: NSMakePoint(16.34, 31)]; + [oval7Path curveToPoint: NSMakePoint(-31, 0.5) controlPoint1: NSMakePoint(-17.34, 31) controlPoint2: NSMakePoint(-31, 17.34)]; + [oval7Path curveToPoint: NSMakePoint(-0.5, -30) controlPoint1: NSMakePoint(-31, -16.34) controlPoint2: NSMakePoint(-17.34, -30)]; + [oval7Path curveToPoint: NSMakePoint(30, 0.5) controlPoint1: NSMakePoint(16.34, -30) controlPoint2: NSMakePoint(30, -16.34)]; + [oval7Path closePath]; + [leftStickColor setFill]; + [oval7Path fill]; + [leftStickStroke setStroke]; + [oval7Path setLineWidth: 2]; + [oval7Path stroke]; + + + //// Oval 10 Drawing + NSBezierPath* oval10Path = NSBezierPath.bezierPath; + [oval10Path moveToPoint: NSMakePoint(1.02, 18.8)]; + [oval10Path curveToPoint: NSMakePoint(-0.5, 20.33) controlPoint1: NSMakePoint(1.02, 19.64) controlPoint2: NSMakePoint(0.34, 20.33)]; + [oval10Path curveToPoint: NSMakePoint(-2.03, 18.8) controlPoint1: NSMakePoint(-1.34, 20.33) controlPoint2: NSMakePoint(-2.03, 19.64)]; + [oval10Path curveToPoint: NSMakePoint(-0.5, 17.27) controlPoint1: NSMakePoint(-2.03, 17.96) controlPoint2: NSMakePoint(-1.34, 17.27)]; + [oval10Path curveToPoint: NSMakePoint(1.02, 18.8) controlPoint1: NSMakePoint(0.34, 17.27) controlPoint2: NSMakePoint(1.02, 17.96)]; + [oval10Path closePath]; + [NSColor.grayColor setFill]; + [oval10Path fill]; + + + //// Oval 11 Drawing + NSBezierPath* oval11Path = NSBezierPath.bezierPath; + [oval11Path moveToPoint: NSMakePoint(-17.28, 0.5)]; + [oval11Path curveToPoint: NSMakePoint(-18.8, 2.02) controlPoint1: NSMakePoint(-17.28, 1.34) controlPoint2: NSMakePoint(-17.96, 2.02)]; + [oval11Path curveToPoint: NSMakePoint(-20.33, 0.5) controlPoint1: NSMakePoint(-19.64, 2.02) controlPoint2: NSMakePoint(-20.33, 1.34)]; + [oval11Path curveToPoint: NSMakePoint(-18.8, -1.02) controlPoint1: NSMakePoint(-20.33, -0.34) controlPoint2: NSMakePoint(-19.64, -1.02)]; + [oval11Path curveToPoint: NSMakePoint(-17.28, 0.5) controlPoint1: NSMakePoint(-17.96, -1.02) controlPoint2: NSMakePoint(-17.28, -0.34)]; + [oval11Path closePath]; + [NSColor.grayColor setFill]; + [oval11Path fill]; + + + //// Oval 12 Drawing + NSBezierPath* oval12Path = NSBezierPath.bezierPath; + [oval12Path moveToPoint: NSMakePoint(19.33, 0.5)]; + [oval12Path curveToPoint: NSMakePoint(17.8, 2.02) controlPoint1: NSMakePoint(19.33, 1.34) controlPoint2: NSMakePoint(18.64, 2.02)]; + [oval12Path curveToPoint: NSMakePoint(16.28, 0.5) controlPoint1: NSMakePoint(16.96, 2.02) controlPoint2: NSMakePoint(16.28, 1.34)]; + [oval12Path curveToPoint: NSMakePoint(17.8, -1.02) controlPoint1: NSMakePoint(16.28, -0.34) controlPoint2: NSMakePoint(16.96, -1.02)]; + [oval12Path curveToPoint: NSMakePoint(19.33, 0.5) controlPoint1: NSMakePoint(18.64, -1.02) controlPoint2: NSMakePoint(19.33, -0.34)]; + [oval12Path closePath]; + [NSColor.grayColor setFill]; + [oval12Path fill]; + + + //// Oval 13 Drawing + NSBezierPath* oval13Path = NSBezierPath.bezierPath; + [oval13Path moveToPoint: NSMakePoint(1.02, -17.8)]; + [oval13Path curveToPoint: NSMakePoint(-0.5, -16.27) controlPoint1: NSMakePoint(1.02, -16.96) controlPoint2: NSMakePoint(0.34, -16.27)]; + [oval13Path curveToPoint: NSMakePoint(-2.03, -17.8) controlPoint1: NSMakePoint(-1.34, -16.27) controlPoint2: NSMakePoint(-2.03, -16.96)]; + [oval13Path curveToPoint: NSMakePoint(-0.5, -19.32) controlPoint1: NSMakePoint(-2.03, -18.64) controlPoint2: NSMakePoint(-1.34, -19.32)]; + [oval13Path curveToPoint: NSMakePoint(1.02, -17.8) controlPoint1: NSMakePoint(0.34, -19.32) controlPoint2: NSMakePoint(1.02, -18.64)]; + [oval13Path closePath]; + [NSColor.grayColor setFill]; + [oval13Path fill]; + + + //// Oval 18 Drawing + NSBezierPath* oval18Path = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect(-29, -28, 57, 57)]; + [NSGraphicsContext saveGraphicsState]; + [oval18Path addClip]; + [gradient drawFromCenter: NSMakePoint(-0.5, 0.5) radius: 4.02 + toCenter: NSMakePoint(-0.5, 0.5) radius: 26.54 + options: NSGradientDrawsBeforeStartingLocation | NSGradientDrawsAfterEndingLocation]; + [NSGraphicsContext restoreGraphicsState]; + } + + + + [NSGraphicsContext restoreGraphicsState]; + } + + + //// LEDs + { + //// Bezier Drawing + NSBezierPath* bezierPath = NSBezierPath.bezierPath; + [bezierPath moveToPoint: NSMakePoint(229.47, 261.06)]; + [bezierPath curveToPoint: NSMakePoint(229.47, 259.31) controlPoint1: NSMakePoint(229.47, 260.58) controlPoint2: NSMakePoint(229.47, 259.99)]; + [bezierPath curveToPoint: NSMakePoint(229.47, 256.11) controlPoint1: NSMakePoint(229.47, 258.4) controlPoint2: NSMakePoint(229.47, 257.32)]; + [bezierPath curveToPoint: NSMakePoint(210.46, 237.1) controlPoint1: NSMakePoint(219.29, 255.42) controlPoint2: NSMakePoint(211.15, 247.28)]; + [bezierPath lineToPoint: NSMakePoint(205.51, 237.1)]; + [bezierPath curveToPoint: NSMakePoint(229.47, 261.06) controlPoint1: NSMakePoint(206.21, 250.01) controlPoint2: NSMakePoint(216.56, 260.35)]; + [bezierPath closePath]; + [led1Color setFill]; + [bezierPath fill]; + + + //// Bezier 3 Drawing + NSBezierPath* bezier3Path = NSBezierPath.bezierPath; + [bezier3Path moveToPoint: NSMakePoint(235.47, 261.06)]; + [bezier3Path curveToPoint: NSMakePoint(259.43, 237.1) controlPoint1: NSMakePoint(248.38, 260.35) controlPoint2: NSMakePoint(258.72, 250.01)]; + [bezier3Path curveToPoint: NSMakePoint(254.48, 237.1) controlPoint1: NSMakePoint(258.27, 237.1) controlPoint2: NSMakePoint(256.52, 237.1)]; + [bezier3Path curveToPoint: NSMakePoint(235.47, 256.11) controlPoint1: NSMakePoint(253.78, 247.28) controlPoint2: NSMakePoint(245.65, 255.42)]; + [bezier3Path curveToPoint: NSMakePoint(235.47, 261.06) controlPoint1: NSMakePoint(235.47, 258.24) controlPoint2: NSMakePoint(235.47, 259.95)]; + [bezier3Path closePath]; + [led2Color setFill]; + [bezier3Path fill]; + + + //// Bezier 2 Drawing + NSBezierPath* bezier2Path = NSBezierPath.bezierPath; + [bezier2Path moveToPoint: NSMakePoint(259.43, 231.1)]; + [bezier2Path curveToPoint: NSMakePoint(235.47, 207.14) controlPoint1: NSMakePoint(258.72, 218.19) controlPoint2: NSMakePoint(248.38, 207.85)]; + [bezier2Path curveToPoint: NSMakePoint(235.47, 212.09) controlPoint1: NSMakePoint(235.47, 208.26) controlPoint2: NSMakePoint(235.47, 209.97)]; + [bezier2Path curveToPoint: NSMakePoint(254.48, 231.1) controlPoint1: NSMakePoint(245.65, 212.79) controlPoint2: NSMakePoint(253.78, 220.92)]; + [bezier2Path lineToPoint: NSMakePoint(259.43, 231.1)]; + [bezier2Path closePath]; + [led4Color setFill]; + [bezier2Path fill]; + + + //// Bezier 4 Drawing + NSBezierPath* bezier4Path = NSBezierPath.bezierPath; + [bezier4Path moveToPoint: NSMakePoint(205.51, 231.1)]; + [bezier4Path curveToPoint: NSMakePoint(207.41, 231.1) controlPoint1: NSMakePoint(206.03, 231.1) controlPoint2: NSMakePoint(206.67, 231.1)]; + [bezier4Path curveToPoint: NSMakePoint(210.46, 231.1) controlPoint1: NSMakePoint(208.31, 231.1) controlPoint2: NSMakePoint(209.34, 231.1)]; + [bezier4Path lineToPoint: NSMakePoint(210.48, 230.79)]; + [bezier4Path curveToPoint: NSMakePoint(229.15, 212.12) controlPoint1: NSMakePoint(211.31, 220.87) controlPoint2: NSMakePoint(219.22, 212.95)]; + [bezier4Path lineToPoint: NSMakePoint(229.47, 212.09)]; + [bezier4Path curveToPoint: NSMakePoint(229.47, 207.14) controlPoint1: NSMakePoint(229.47, 209.97) controlPoint2: NSMakePoint(229.47, 208.26)]; + [bezier4Path curveToPoint: NSMakePoint(228.25, 207.24) controlPoint1: NSMakePoint(229.06, 207.17) controlPoint2: NSMakePoint(228.65, 207.2)]; + [bezier4Path curveToPoint: NSMakePoint(206.28, 226.11) controlPoint1: NSMakePoint(217.6, 208.33) controlPoint2: NSMakePoint(208.91, 216)]; + [bezier4Path curveToPoint: NSMakePoint(205.51, 231.1) controlPoint1: NSMakePoint(205.87, 227.72) controlPoint2: NSMakePoint(205.6, 229.39)]; + [bezier4Path closePath]; + [led3Color setFill]; + [bezier4Path fill]; + } + + + //// LEDs + { + //// Bezier Drawing + NSBezierPath* bezierPath = NSBezierPath.bezierPath; + [bezierPath moveToPoint: NSMakePoint(229.47, 261.06)]; + [bezierPath curveToPoint: NSMakePoint(229.47, 259.31) controlPoint1: NSMakePoint(229.47, 260.58) controlPoint2: NSMakePoint(229.47, 259.99)]; + [bezierPath curveToPoint: NSMakePoint(229.47, 256.11) controlPoint1: NSMakePoint(229.47, 258.4) controlPoint2: NSMakePoint(229.47, 257.32)]; + [bezierPath curveToPoint: NSMakePoint(210.46, 237.1) controlPoint1: NSMakePoint(219.29, 255.42) controlPoint2: NSMakePoint(211.15, 247.28)]; + [bezierPath lineToPoint: NSMakePoint(205.51, 237.1)]; + [bezierPath curveToPoint: NSMakePoint(229.47, 261.06) controlPoint1: NSMakePoint(206.21, 250.01) controlPoint2: NSMakePoint(216.56, 260.35)]; + [bezierPath closePath]; + [led1Color setFill]; + [bezierPath fill]; + + + //// Bezier 3 Drawing + NSBezierPath* bezier3Path = NSBezierPath.bezierPath; + [bezier3Path moveToPoint: NSMakePoint(235.47, 261.06)]; + [bezier3Path curveToPoint: NSMakePoint(259.43, 237.1) controlPoint1: NSMakePoint(248.38, 260.35) controlPoint2: NSMakePoint(258.72, 250.01)]; + [bezier3Path curveToPoint: NSMakePoint(254.48, 237.1) controlPoint1: NSMakePoint(258.27, 237.1) controlPoint2: NSMakePoint(256.52, 237.1)]; + [bezier3Path curveToPoint: NSMakePoint(235.47, 256.11) controlPoint1: NSMakePoint(253.78, 247.28) controlPoint2: NSMakePoint(245.65, 255.42)]; + [bezier3Path curveToPoint: NSMakePoint(235.47, 261.06) controlPoint1: NSMakePoint(235.47, 258.24) controlPoint2: NSMakePoint(235.47, 259.95)]; + [bezier3Path closePath]; + [led2Color setFill]; + [bezier3Path fill]; + + + //// Bezier 2 Drawing + NSBezierPath* bezier2Path = NSBezierPath.bezierPath; + [bezier2Path moveToPoint: NSMakePoint(259.43, 231.1)]; + [bezier2Path curveToPoint: NSMakePoint(235.47, 207.14) controlPoint1: NSMakePoint(258.72, 218.19) controlPoint2: NSMakePoint(248.38, 207.85)]; + [bezier2Path curveToPoint: NSMakePoint(235.47, 212.09) controlPoint1: NSMakePoint(235.47, 208.26) controlPoint2: NSMakePoint(235.47, 209.97)]; + [bezier2Path curveToPoint: NSMakePoint(254.48, 231.1) controlPoint1: NSMakePoint(245.65, 212.79) controlPoint2: NSMakePoint(253.78, 220.92)]; + [bezier2Path lineToPoint: NSMakePoint(259.43, 231.1)]; + [bezier2Path closePath]; + [led4Color setFill]; + [bezier2Path fill]; + + + //// Bezier 4 Drawing + NSBezierPath* bezier4Path = NSBezierPath.bezierPath; + [bezier4Path moveToPoint: NSMakePoint(205.51, 231.1)]; + [bezier4Path curveToPoint: NSMakePoint(207.41, 231.1) controlPoint1: NSMakePoint(206.03, 231.1) controlPoint2: NSMakePoint(206.67, 231.1)]; + [bezier4Path curveToPoint: NSMakePoint(210.46, 231.1) controlPoint1: NSMakePoint(208.31, 231.1) controlPoint2: NSMakePoint(209.34, 231.1)]; + [bezier4Path lineToPoint: NSMakePoint(210.48, 230.79)]; + [bezier4Path curveToPoint: NSMakePoint(229.15, 212.12) controlPoint1: NSMakePoint(211.31, 220.87) controlPoint2: NSMakePoint(219.22, 212.95)]; + [bezier4Path lineToPoint: NSMakePoint(229.47, 212.09)]; + [bezier4Path curveToPoint: NSMakePoint(229.47, 207.14) controlPoint1: NSMakePoint(229.47, 209.97) controlPoint2: NSMakePoint(229.47, 208.26)]; + [bezier4Path curveToPoint: NSMakePoint(228.25, 207.24) controlPoint1: NSMakePoint(229.06, 207.17) controlPoint2: NSMakePoint(228.65, 207.2)]; + [bezier4Path curveToPoint: NSMakePoint(206.28, 226.11) controlPoint1: NSMakePoint(217.6, 208.33) controlPoint2: NSMakePoint(208.91, 216)]; + [bezier4Path curveToPoint: NSMakePoint(205.51, 231.1) controlPoint1: NSMakePoint(205.87, 227.72) controlPoint2: NSMakePoint(205.6, 229.39)]; + [bezier4Path closePath]; + [led3Color setFill]; + [bezier4Path fill]; + } +} + ++ (void)drawTriggerMetterWithIntensity: (CGFloat)intensity triggerTitle: (NSString*)triggerTitle +{ + //// General Declarations + CGContextRef context = (CGContextRef)NSGraphicsContext.currentContext.graphicsPort; + + //// Color Declarations + NSColor* controller = [NSColor colorWithCalibratedRed: 0.232 green: 0.232 blue: 0.232 alpha: 1]; + NSColor* darkController = [controller shadowWithLevel: 0.3]; + NSColor* pressed = [NSColor colorWithCalibratedRed: 1 green: 0.432 blue: 0 alpha: 1]; + + //// Variable Declarations + CGFloat expression = 360 - 270 * intensity - 135; + + //// Oval 18 Drawing + NSRect oval18Rect = NSMakeRect(-0, -0, 45, 45); + NSBezierPath* oval18Path = [NSBezierPath bezierPathWithOvalInRect: oval18Rect]; + [controller setFill]; + [oval18Path fill]; + NSMutableParagraphStyle* oval18Style = NSMutableParagraphStyle.defaultParagraphStyle.mutableCopy; + oval18Style.alignment = NSCenterTextAlignment; + + NSDictionary* oval18FontAttributes = @{NSFontAttributeName: [NSFont boldSystemFontOfSize: NSFont.systemFontSize], NSForegroundColorAttributeName: NSColor.whiteColor, NSParagraphStyleAttributeName: oval18Style}; + + CGFloat oval18TextHeight = NSHeight([triggerTitle boundingRectWithSize: oval18Rect.size options: NSStringDrawingUsesLineFragmentOrigin attributes: oval18FontAttributes]); + NSRect oval18TextRect = NSMakeRect(NSMinX(oval18Rect), NSMinY(oval18Rect) + (NSHeight(oval18Rect) - oval18TextHeight) / 2, NSWidth(oval18Rect), oval18TextHeight); + [NSGraphicsContext saveGraphicsState]; + NSRectClip(oval18Rect); + [triggerTitle drawInRect: NSOffsetRect(oval18TextRect, 0, 1) withAttributes: oval18FontAttributes]; + [NSGraphicsContext restoreGraphicsState]; + + + //// Oval 19 Drawing + NSBezierPath* oval19Path = NSBezierPath.bezierPath; + [oval19Path moveToPoint: NSMakePoint(39, 22.5)]; + [oval19Path curveToPoint: NSMakePoint(22.5, 39) controlPoint1: NSMakePoint(39, 31.61) controlPoint2: NSMakePoint(31.61, 39)]; + [oval19Path curveToPoint: NSMakePoint(6, 22.5) controlPoint1: NSMakePoint(13.39, 39) controlPoint2: NSMakePoint(6, 31.61)]; + [oval19Path curveToPoint: NSMakePoint(22.5, 6) controlPoint1: NSMakePoint(6, 13.39) controlPoint2: NSMakePoint(13.39, 6)]; + [oval19Path curveToPoint: NSMakePoint(39, 22.5) controlPoint1: NSMakePoint(31.61, 6) controlPoint2: NSMakePoint(39, 13.39)]; + [oval19Path closePath]; + [darkController setStroke]; + [oval19Path setLineWidth: 1]; + [oval19Path stroke]; + + + //// Oval 20 Drawing + [NSGraphicsContext saveGraphicsState]; + CGContextTranslateCTM(context, 22.5, 22.5); + + NSRect oval20Rect = NSMakeRect(-19.5, -19.5, 39, 39); + NSBezierPath* oval20Path = NSBezierPath.bezierPath; + [oval20Path appendBezierPathWithArcWithCenter: NSMakePoint(NSMidX(oval20Rect), NSMidY(oval20Rect)) radius: NSWidth(oval20Rect) / 2 startAngle: -135 endAngle: expression clockwise: YES]; + + [pressed setStroke]; + [oval20Path setLineWidth: 3]; + [oval20Path stroke]; + + [NSGraphicsContext restoreGraphicsState]; + + + //// Oval Drawing + NSBezierPath* ovalPath = NSBezierPath.bezierPath; + [ovalPath moveToPoint: NSMakePoint(36.29, 8.71)]; + [ovalPath curveToPoint: NSMakePoint(8.71, 8.71) controlPoint1: NSMakePoint(28.67, 1.1) controlPoint2: NSMakePoint(16.33, 1.1)]; + [darkController setStroke]; + [ovalPath setLineWidth: 5.5]; + [ovalPath stroke]; +} + ++ (void)drawBatteryMonitorWithBars: (CGFloat)bars +{ + //// Color Declarations + NSColor* buttonB = [NSColor colorWithCalibratedRed: 1 green: 0.094 blue: 0.072 alpha: 1]; + NSColor* controller = [NSColor colorWithCalibratedRed: 0.232 green: 0.232 blue: 0.232 alpha: 1]; + NSColor* darkController = [controller shadowWithLevel: 0.3]; + + //// Variable Declarations + NSColor* batteryColor = bars > 0 ? darkController : buttonB; + BOOL bar1 = bars > 0; + BOOL bar2 = bars > 1; + BOOL bar3 = bars > 2; + + //// Rectangle 3 Drawing + NSBezierPath* rectangle3Path = NSBezierPath.bezierPath; + [rectangle3Path moveToPoint: NSMakePoint(1, 2.46)]; + [rectangle3Path curveToPoint: NSMakePoint(2.36, 1) controlPoint1: NSMakePoint(1, 1.65) controlPoint2: NSMakePoint(1.61, 1)]; + [rectangle3Path lineToPoint: NSMakePoint(35.64, 1)]; + [rectangle3Path curveToPoint: NSMakePoint(37, 2.46) controlPoint1: NSMakePoint(36.39, 1) controlPoint2: NSMakePoint(37, 1.65)]; + [rectangle3Path lineToPoint: NSMakePoint(37, 18.54)]; + [rectangle3Path curveToPoint: NSMakePoint(35.64, 20) controlPoint1: NSMakePoint(37, 19.35) controlPoint2: NSMakePoint(36.39, 20)]; + [rectangle3Path lineToPoint: NSMakePoint(2.36, 20)]; + [rectangle3Path curveToPoint: NSMakePoint(1, 18.54) controlPoint1: NSMakePoint(1.61, 20) controlPoint2: NSMakePoint(1, 19.35)]; + [rectangle3Path lineToPoint: NSMakePoint(1, 2.46)]; + [rectangle3Path closePath]; + [batteryColor setStroke]; + [rectangle3Path setLineWidth: 2]; + [rectangle3Path stroke]; + + + if (bar1) + { + //// Rectangle Drawing + NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRect: NSMakeRect(3, 3, 10, 15)]; + [darkController setFill]; + [rectanglePath fill]; + } + + + if (bar2) + { + //// Rectangle 2 Drawing + NSBezierPath* rectangle2Path = [NSBezierPath bezierPathWithRect: NSMakeRect(14, 3, 10, 15)]; + [darkController setFill]; + [rectangle2Path fill]; + } + + + if (bar3) + { + //// Rectangle 4 Drawing + NSBezierPath* rectangle4Path = [NSBezierPath bezierPathWithRect: NSMakeRect(25, 3, 10, 15)]; + [darkController setFill]; + [rectangle4Path fill]; + } + + + //// Rectangle 5 Drawing + NSBezierPath* rectangle5Path = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(36, 6, 5, 9) xRadius: 1 yRadius: 1]; + [batteryColor setFill]; + [rectangle5Path fill]; +} + ++ (void)drawDeadZoneViewerWithValue: (CGFloat)value linked: (BOOL)linked +{ + //// Color Declarations + NSColor* deadzone = [NSColor colorWithCalibratedRed: 0.922 green: 0 blue: 1 alpha: 1]; + + //// Variable Declarations + CGFloat width = 62 * value; + CGFloat center = 32.5 - width / 2.0; + BOOL circle = linked && value != 0; + BOOL biSquare = !(value == 0 || linked); + + if (biSquare) + { + //// Rectangle Drawing + NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRect: NSMakeRect(center, 1.5, width, 62)]; + [deadzone setStroke]; + [rectanglePath setLineWidth: 2]; + CGFloat rectanglePattern[] = {2, 2}; + [rectanglePath setLineDash: rectanglePattern count: 2 phase: 0]; + [rectanglePath stroke]; + + + //// Rectangle 2 Drawing + NSBezierPath* rectangle2Path = [NSBezierPath bezierPathWithRect: NSMakeRect(1.5, center, 62, width)]; + [deadzone setStroke]; + [rectangle2Path setLineWidth: 2]; + CGFloat rectangle2Pattern[] = {2, 2}; + [rectangle2Path setLineDash: rectangle2Pattern count: 2 phase: 0]; + [rectangle2Path stroke]; + } + + + if (circle) + { + //// Oval Drawing + NSBezierPath* ovalPath = [NSBezierPath bezierPathWithOvalInRect: NSMakeRect(center, center, width, width)]; + [deadzone setStroke]; + [ovalPath setLineWidth: 2]; + CGFloat ovalPattern[] = {2, 2}; + [ovalPath setLineDash: ovalPattern count: 2 phase: 0]; + [ovalPath stroke]; + } +} + +@end diff --git a/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/AboutTemplate.png b/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/AboutTemplate.png new file mode 100644 index 0000000..f52cbb3 Binary files /dev/null and b/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/AboutTemplate.png differ diff --git a/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/AboutTemplate@2x.png b/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/AboutTemplate@2x.png new file mode 100644 index 0000000..1510947 Binary files /dev/null and b/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/AboutTemplate@2x.png differ diff --git a/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/Contents.json b/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/Contents.json new file mode 100644 index 0000000..f02f180 --- /dev/null +++ b/Pref360Control/Resources/artworks.xcassets/AboutTemplate.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "filename" : "AboutTemplate.png" + }, + { + "idiom" : "mac", + "scale" : "2x", + "filename" : "AboutTemplate@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/Contents.json b/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/Contents.json new file mode 100644 index 0000000..ed9a493 --- /dev/null +++ b/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/Contents.json @@ -0,0 +1,18 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "1x", + "filename" : "PowerOffTemplate.png" + }, + { + "idiom" : "mac", + "scale" : "2x", + "filename" : "PowerOffTemplate@2x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/PowerOffTemplate.png b/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/PowerOffTemplate.png new file mode 100644 index 0000000..cf77c19 Binary files /dev/null and b/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/PowerOffTemplate.png differ diff --git a/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/PowerOffTemplate@2x.png b/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/PowerOffTemplate@2x.png new file mode 100644 index 0000000..3979280 Binary files /dev/null and b/Pref360Control/Resources/artworks.xcassets/PowerOffTemplate.imageset/PowerOffTemplate@2x.png differ diff --git a/Pref360Control/Resources/batt0.png b/Pref360Control/Resources/batt0.png new file mode 100644 index 0000000..611cf2a Binary files /dev/null and b/Pref360Control/Resources/batt0.png differ diff --git a/Pref360Control/Resources/batt0@2x.png b/Pref360Control/Resources/batt0@2x.png new file mode 100644 index 0000000..e680492 Binary files /dev/null and b/Pref360Control/Resources/batt0@2x.png differ diff --git a/Pref360Control/Resources/batt1.png b/Pref360Control/Resources/batt1.png new file mode 100644 index 0000000..01ebdef Binary files /dev/null and b/Pref360Control/Resources/batt1.png differ diff --git a/Pref360Control/Resources/batt1@2x.png b/Pref360Control/Resources/batt1@2x.png new file mode 100644 index 0000000..9215ef7 Binary files /dev/null and b/Pref360Control/Resources/batt1@2x.png differ diff --git a/Pref360Control/Resources/batt2.png b/Pref360Control/Resources/batt2.png new file mode 100644 index 0000000..7d53c87 Binary files /dev/null and b/Pref360Control/Resources/batt2.png differ diff --git a/Pref360Control/Resources/batt2@2x.png b/Pref360Control/Resources/batt2@2x.png new file mode 100644 index 0000000..8f146c4 Binary files /dev/null and b/Pref360Control/Resources/batt2@2x.png differ diff --git a/Pref360Control/Resources/batt3.png b/Pref360Control/Resources/batt3.png new file mode 100644 index 0000000..41ede75 Binary files /dev/null and b/Pref360Control/Resources/batt3.png differ diff --git a/Pref360Control/Resources/batt3@2x.png b/Pref360Control/Resources/batt3@2x.png new file mode 100644 index 0000000..955277a Binary files /dev/null and b/Pref360Control/Resources/batt3@2x.png differ diff --git a/Pref360Control/batt0.tif b/Pref360Control/batt0.tif deleted file mode 100644 index ff3b09c..0000000 Binary files a/Pref360Control/batt0.tif and /dev/null differ diff --git a/Pref360Control/batt1.tif b/Pref360Control/batt1.tif deleted file mode 100644 index 42b5218..0000000 Binary files a/Pref360Control/batt1.tif and /dev/null differ diff --git a/Pref360Control/batt2.tif b/Pref360Control/batt2.tif deleted file mode 100644 index 5475dc4..0000000 Binary files a/Pref360Control/batt2.tif and /dev/null differ diff --git a/Pref360Control/batt3.tif b/Pref360Control/batt3.tif deleted file mode 100644 index f0424a7..0000000 Binary files a/Pref360Control/batt3.tif and /dev/null differ diff --git a/Pref360Control/battNone.tif b/Pref360Control/battNone.tif deleted file mode 100644 index 6f1aa62..0000000 Binary files a/Pref360Control/battNone.tif and /dev/null differ diff --git a/Pref360Control/en.lproj/InfoPlist.strings b/Pref360Control/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..f9b04f1 --- /dev/null +++ b/Pref360Control/en.lproj/InfoPlist.strings @@ -0,0 +1,4 @@ +/* Localized versions of Info.plist keys */ + +NSHumanReadableCopyright = "Copyright (c) 2006-2013, Colin Munro."; +NSPrefPaneIconLabel = "Xbox 360\nControllers"; diff --git a/Pref360Control/en.lproj/Localizable.strings b/Pref360Control/en.lproj/Localizable.strings new file mode 100644 index 0000000..24047a1 --- /dev/null +++ b/Pref360Control/en.lproj/Localizable.strings @@ -0,0 +1,11 @@ +/* + Localizable.strings + 360 Driver + + Created by C.W. Betts on 3/16/14. + Copyright (c) 2014 GitHub. All rights reserved. +*/ + +"Unable to create authorisation request" = "Unable to create authorization request"; +"Unable to acquire authorisation" = "Unable to acquire authorization"; +"Failed to execute the driver tool" = "Failed to execute the driver tool"; diff --git a/Pref360Control/en.lproj/Pref360ControlPref.xib b/Pref360Control/en.lproj/Pref360ControlPref.xib new file mode 100644 index 0000000..b560a24 --- /dev/null +++ b/Pref360Control/en.lproj/Pref360ControlPref.xib @@ -0,0 +1,925 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + You can disable the driver temporarily so your Xbox device can be used in games that access the hardware directly. + +This may be useful when playing some games ported by Aspyr if it supports your device. + +Due to some internal limitations, you need to connect your device once to be able to disable this. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + About the Xbox 360 Controller Driver for Mac OS X + + + + + + + + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce iaculis diam eget nunc maximus semper. Curabitur vel dui pellentesque, feugiat massa vitae, dignissim nibh. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam laoreet lorem posuere felis faucibus semper at id dolor. In maximus pharetra tristique. Proin eu erat pharetra, ullamcorper nisi sit amet, fringilla risus. Phasellus venenatis molestie leo in bibendum. Cras arcu nibh, feugiat nec finibus eget, placerat quis nisl. Nullam quis ligula dignissim, placerat sapien id, volutpat turpis. Aliquam sed diam quis neque maximus pulvinar nec a tortor. Aliquam gravida nibh et rhoncus convallis. +Phasellus vel risus maximus, ultricies purus vel, finibus augue. Vivamus consectetur cursus congue. Phasellus at tortor vel magna elementum sollicitudin sit amet vitae ex. In risus felis, tincidunt in felis in, consequat commodo lacus. Donec id nibh et elit elementum egestas. In vel porta dui. Maecenas vel aliquet dolor. +Nunc ut consequat purus. Morbi sed risus eu magna dignissim pulvinar. Morbi et egestas odio, vitae consectetur neque. Nullam ante urna, lacinia id consectetur sed, eleifend id nulla. Nullam rhoncus ligula id interdum porta. Mauris in ligula diam. Nulla gravida vitae enim vitae pharetra. Suspendisse potenti. Sed sed massa a mauris scelerisque elementum. Etiam ac urna vestibulum, pellentesque dui eu, lobortis augue. Nunc ac elit sit amet augue malesuada malesuada vel id nisi. + + + + + + + + + + + +Cg + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pref360Control/version.plist b/Pref360Control/version.plist deleted file mode 100644 index 3c5239f..0000000 --- a/Pref360Control/version.plist +++ /dev/null @@ -1,18 +0,0 @@ - - - - - BuildVersion - 328 - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - ProductBuildVersion - 7K571 - ProjectName - PreferencePaneTemplate - SourceVersion - 120000 - - diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..bd1eff4 --- /dev/null +++ b/Readme.md @@ -0,0 +1,116 @@ +# XBox 360 Controller driver for Mac OS X + +## About ## + +This driver supports the Microsoft Xbox 360 controller, including access to +rumble motors and LEDs, on the Mac OS X platform. It includes a plugin for the +Apple Force Feedback Framework so some games will be able to activate them, +along with a Preference Pane with which allows you to test everything is +installed correctly. Both wired 360 controllers connected via USB, and wireless +360 controllers connected via the Wireless Gaming Receiver for Windows, are +supported. + +This project is a fork of the [Xbox360Controller project][1] originally created +by Colin Munro. + +[1]: http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller + + +## Installation ## + +See the [releases page][2] for the latest compiled and signed version of the +driver. Most users will want to install and run this. + +If you are interested in installing as a developer please see below. + +[2]: https://github.com/d235j/360Controller/releases + + +## Usage ## + +The driver exposes a standard game pad with a number of standard controls, so +any game that supports gaming devices should work. In some cases this may need +an update from the manufacturer of the game or a patched version. The +Preference Pane uses the standard Mac OS X Frameworks for accessing HID devices +and accessing Force Feedback capabilities, so should be a good test that the +installation is functional. + +[List of working and non-working games.](https://github.com/d235j/360Controller/wiki/Games) + + +## Developer info ## + +Anything below this probably doesn't affect end users, so you can stop reading +now if you just want to use the driver. + + +### Building ### + +You'll need the full xcode installed via the app store. The command line tools +are not enough. + +From the command line, run: `./build.sh` + +If you'd like to build the .pkg file, there is an installer project for +Packages. Download packages at +[http://s.sudre.free.fr/Software/Packages/about.html][3] +and the resulting dmg file will be copied to the build directory. + +[3]: http://s.sudre.free.fr/Software/Packages/about.html + +The distribution currently consists of 3 projects - one for the driver +(implemented in C++, as an I/O Kit C++ class), one for the force feedback +support plugin (implemented in C, as an I/O Kit COM plugin) and one for the +Preference Pane (implemented in Objective C as a preference pane plugin). +Ideally these 3 targets should be in the same project, but I've not worked on +this yet. + +To build, use the standard Xcode build for Deployment on each of the 3 +projects. Build Feedback360 before 360Controller, as the 360Controller project +includes a script to copy the Feedback360 bundle to the correct place in the +.kext to make it work. + +To debug the driver, `sudo cp -R 360Controller.kext /tmp/` to assign the +correct properties - note that the Force Feedback plugin only seems to be found +by OSX if the driver is in `/System/Library/Extensions` so I could only debug +it in place. + +To test the Preference Pane, just double-click the resulting file. + + +### Yosemite and signed drivers ### + +Since Yosemite (Mac OS X 10.10) all global kexts are required to be signed. +This means if you want to build the drivers and install locally, you need to +have a mac developer account. + +If you'd like to avoid paying apple for the developer account and want to +disable the signature checking, execute the following commands inside a +terminal: + +``` bash +sudo nvram boot-args="kext-dev-mode=1" +sudo kextcache -m /System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext /System/Library/Extensions +``` + +Note that this is probably a bad idea unless you understand the implications of +running unsigned driver code. + + +### Debugging ### + +Most of the debugging I did was via printing out text. In 360Controller, you +can use IOLog(), and the output will appear in system.log. In Feedback360 +normal `fprintf(stderr,...)`, and the output will appear on the console of +whatever application is attempting to use Force Feedback. In Pref360Control, +`NSLog()` works as it's an Objective C program, and will output to the console +of the Preferences application. + + +## Licence ## + +Copyright (C) 2006-2013 Colin Munro + +This driver is licensed under the GNU Public License. A copy of this license is +included in the distribution file, please inspect it before using the binary or +source. diff --git a/Readme.rtf b/Readme.rtf deleted file mode 100644 index d59c4a4..0000000 --- a/Readme.rtf +++ /dev/null @@ -1,86 +0,0 @@ -{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf340 -\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;} -{\colortbl;\red255\green255\blue255;} -{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1} -{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2}} -{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}} -\paperw12240\paperh15840\margl1440\margr1440\vieww9000\viewh8400\viewkind0 -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural - -\f0\b\fs36 \cf0 XBox 360 Controller driver for Mac OS X -\b0\fs24 \ -Copyright (C) 2006-2013 Colin Munro\ -{\field{\*\fldinst{HYPERLINK "http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller"}}{\fldrslt http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller}}\ -\ - -\b About -\b0 \ -This driver supports the Microsoft Xbox 360 controller, including access to rumble motors and LEDs, on the Mac OS X platform. It includes a plugin for the Apple Force Feedback Framework so some games will be able to activate them, along with a Preference Pane with which allows you to test everything is installed correctly. Both wired 360 controllers connected via USB, and wireless 360 controllers connected via the Wireless Gaming Receiver for Windows, are supported.\ -\ - -\b Licence -\b0 \ -This driver is licensed under the GNU Public License. A copy of this license is included in the distribution file, please inspect it before using the binary or source.\ -\ - -\b Installation -\b0 \ -Simply complete the installer package to install the driver. The driver will recommend you restart - if you do not, the driver will only be usable if the controller is already connected or connected within a minute after the installer completes. If you are interested in installing as a developer please see below.\ -\ - -\b Usage -\b0 \ -The driver exposes a standard game pad with a number of standard controls, so any game that supports gaming devices should work. In some cases this may need an update from the manufacturer of the game or a patched version. The Preference Pane uses the standard Mac OS X Frameworks for accessing HID devices and accessing Force Feedback capabilities, so should be a good test that the installation is functional.\ -\ - -\b Known Problems/Todo -\b0 \ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls1\ilvl0\cf0 {\listtext \'95 }The rumble motor test on the triggers of the Preference Pane bypasses the Force Feedback Framework functionality, so isn't actually testing it. It really should, for completeness (and it'd help adding support for more complex effects) - this test is now disabled in the normal release anyway\ -{\listtext \'95 }Force Feedback plugin may make effects run slower (e.g. longer time) than they should\ -{\listtext \'95 }Driver probably needs to be more resilient to errors and odd cases\ -{\listtext \'95 }Better Force Feedback "emulation"\ -{\listtext \'95 }Extra settings? E.g. trigger deadzones, control remapping.\ -{\listtext \'95 }Someone has requested old Xbox Controller support too.\ -\pard\tx220\tx720\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li720\fi-720\pardirnatural -\ls2\ilvl0 -\b \cf0 \ -Contact me -\b0 \ -\pard\tx0\tx220\tx660\tx720\tx740\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\ls2\ilvl0\cf0 Please feel free to contact me with any comments, questions and so on using the form at the URL at the top of the file.\ -\ -\pard\tx0\tx220\tx660\tx720\tx740\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\ls2\ilvl0 -\b \cf0 Developer info -\b0 \ -Anything below this probably doesn't affect end users, so you can stop reading now if you just want to use the driver.\ -\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural -\cf0 \ - -\b Building -\b0 \ -(This section does not yet discuss the source of the wireless drivers)\ -The distribution currently consists of 3 projects - one for the driver (implemented in C++, as an I/O Kit C++ class), one for the force feedback support plugin (implemented in C, as an I/O Kit COM plugin) and one for the Preference Pane (implemented in Objective C as a preference pane plugin). Ideally these 3 targets should be in the same project, but I've not worked on this yet.\ -\ -To build, use the standard Xcode build for Deployment on each of the 3 projects. Build Feedback360 before 360Controller, as the 360Controller project includes a script to copy the Feedback360 bundle to the correct place in the .kext to make it work.\ -\ -To debug the driver, sudo cp -R 360Controller.kext /tmp/ to assign the correct properties - note that the Force Feedback plugin only seems to be found by OSX if the driver is in /System/Library/Extensions so I could only debug it in place.\ -\ -To test the Preference Pane, just double-click the resulting file.\ -\ - -\b Debugging -\b0 \ -Most of the debugging I did was via printing out text. In 360Controller, you can use IOLog(), and the output will appear in system.log. In Feedback360 normal fprintf(stderr,...), and the output will appear on the console of whatever application is attempting to use Force Feedback. In Pref360Control NSLog() works as it's an Objective C program, and will output to the console of the Preferences application.\ -\ - -\b Installer -\b0 \ -Included is an installer project for Iceberg. Download Iceberg at {\field{\*\fldinst{HYPERLINK "http://s.sudre.free.fr/Software/Iceberg.html"}}{\fldrslt http://s.sudre.free.fr/Software/Iceberg.html}}\ -\ - -\b Other information -\b0 \ -I wrote the driver from scratch, using Apple documentation and drivers simply as a reference and not basing it upon any existing source. As such, some things may be done strangely or incorrectly, so excuse any weirdness. I've also tried to include comments to explain generally what's going on :)\ -} \ No newline at end of file diff --git a/Wireless360Controller/English.lproj/InfoPlist.strings b/Wireless360Controller/English.lproj/InfoPlist.strings index 2168454..e15e7bb 100644 Binary files a/Wireless360Controller/English.lproj/InfoPlist.strings and b/Wireless360Controller/English.lproj/InfoPlist.strings differ diff --git a/Wireless360Controller/IOKitDriver.pbproj/project.pbxproj b/Wireless360Controller/IOKitDriver.pbproj/project.pbxproj deleted file mode 100644 index d24a1a0..0000000 --- a/Wireless360Controller/IOKitDriver.pbproj/project.pbxproj +++ /dev/null @@ -1,311 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - 06AA1265FFB2107B11CA28AA = { - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OPTIMIZATION_CFLAGS = "-O0"; - ZERO_LINK = YES; - }; - isa = PBXBuildStyle; - name = Development; - }; - 06AA1266FFB2107B11CA28AA = { - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - ZERO_LINK = NO; - }; - isa = PBXBuildStyle; - name = Deployment; - }; -//060 -//061 -//062 -//063 -//064 -//080 -//081 -//082 -//083 -//084 - 089C1669FE841209C02AAC07 = { - buildSettings = { - }; - buildStyles = ( - 06AA1265FFB2107B11CA28AA, - 06AA1266FFB2107B11CA28AA, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = 089C166AFE841209C02AAC07; - projectDirPath = ""; - targets = ( - 32D94FC30562CBF700B6AF17, - ); - }; - 089C166AFE841209C02AAC07 = { - children = ( - 247142CAFF3F8F9811CA285C, - 8DA80CCF06AD972A00E5AC22, - 089C167CFE841241C02AAC07, - 19C28FB6FE9D52B211CA2CBB, - ); - isa = PBXGroup; - name = "«PROJECTNAME»"; - refType = 4; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 = { - children = ( - 32D94FCF0562CBF700B6AF17, - 089C167DFE841241C02AAC07, - ); - isa = PBXGroup; - name = Resources; - refType = 4; - sourceTree = ""; - }; - 089C167DFE841241C02AAC07 = { - children = ( - 089C167EFE841241C02AAC07, - ); - isa = PBXVariantGroup; - name = InfoPlist.strings; - refType = 4; - sourceTree = ""; - }; - 089C167EFE841241C02AAC07 = { - fileEncoding = 10; - isa = PBXFileReference; - lastKnownFileType = text.plist.strings; - name = English; - path = English.lproj/InfoPlist.strings; - refType = 4; - sourceTree = ""; - }; -//080 -//081 -//082 -//083 -//084 -//190 -//191 -//192 -//193 -//194 - 19C28FB6FE9D52B211CA2CBB = { - children = ( - 32D94FD00562CBF700B6AF17, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = ""; - }; -//190 -//191 -//192 -//193 -//194 -//1A0 -//1A1 -//1A2 -//1A3 -//1A4 - 1A224C3EFF42367911CA2CB7 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = file; - path = "«PROJECTNAMEASIDENTIFIER».h"; - refType = 4; - sourceTree = ""; - }; - 1A224C3FFF42367911CA2CB7 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = file; - path = "«PROJECTNAMEASIDENTIFIER».cpp"; - refType = 4; - sourceTree = ""; - }; -//1A0 -//1A1 -//1A2 -//1A3 -//1A4 -//240 -//241 -//242 -//243 -//244 - 247142CAFF3F8F9811CA285C = { - children = ( - 1A224C3EFF42367911CA2CB7, - 1A224C3FFF42367911CA2CB7, - ); - isa = PBXGroup; - name = Source; - path = ""; - refType = 4; - sourceTree = ""; - }; -//240 -//241 -//242 -//243 -//244 -//320 -//321 -//322 -//323 -//324 - 32D94FC30562CBF700B6AF17 = { - buildPhases = ( - 32D94FC40562CBF700B6AF17, - 32D94FC50562CBF700B6AF17, - 32D94FC70562CBF700B6AF17, - 32D94FC90562CBF700B6AF17, - 32D94FCB0562CBF700B6AF17, - 32D94FCC0562CBF700B6AF17, - 32D94FCD0562CBF700B6AF17, - ); - buildRules = ( - ); - buildSettings = { - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = "com.yourcompany.driver.«PROJECTNAMEASIDENTIFIER»"; - MODULE_VERSION = 1.0.0d1; - PRODUCT_NAME = "«PROJECTNAME»"; - WRAPPER_EXTENSION = kext; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = "«PROJECTNAME»"; - productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - productName = "«PROJECTNAME»"; - productReference = 32D94FD00562CBF700B6AF17; - productType = "com.apple.product-type.kernel-extension.iokit"; - }; - 32D94FC40562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXShellScriptBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPreprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi"; - }; - 32D94FC50562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - 32D94FC60562CBF700B6AF17, - ); - isa = PBXHeadersBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FC60562CBF700B6AF17 = { - fileRef = 1A224C3EFF42367911CA2CB7; - isa = PBXBuildFile; - settings = { - }; - }; - 32D94FC70562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - 32D94FC80562CBF700B6AF17, - ); - isa = PBXResourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FC80562CBF700B6AF17 = { - fileRef = 089C167DFE841241C02AAC07; - isa = PBXBuildFile; - settings = { - }; - }; - 32D94FC90562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - 32D94FCA0562CBF700B6AF17, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FCA0562CBF700B6AF17 = { - fileRef = 1A224C3FFF42367911CA2CB7; - isa = PBXBuildFile; - settings = { - ATTRIBUTES = ( - ); - }; - }; - 32D94FCB0562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FCC0562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXRezBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FCD0562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXShellScriptBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPostprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi"; - }; - 32D94FCF0562CBF700B6AF17 = { - isa = PBXFileReference; - lastKnownFileType = text.xml; - path = Info.plist; - refType = 4; - sourceTree = ""; - }; - 32D94FD00562CBF700B6AF17 = { - explicitFileType = wrapper.cfbundle; - includeInIndex = 0; - isa = PBXFileReference; - path = "«PROJECTNAME».kext"; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; -//320 -//321 -//322 -//323 -//324 -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 - 8DA80CCF06AD972A00E5AC22 = { - isa = PBXFileReference; - lastKnownFileType = wrapper.framework; - name = Kernel.framework; - path = /System/Library/Frameworks/Kernel.framework; - refType = 0; - sourceTree = ""; - }; - }; - rootObject = 089C1669FE841209C02AAC07; -} diff --git a/Wireless360Controller/Info.plist b/Wireless360Controller/Info.plist index 1164471..1072cef 100644 --- a/Wireless360Controller/Info.plist +++ b/Wireless360Controller/Info.plist @@ -6,8 +6,6 @@ English CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - CFBundleIdentifier com.mice.driver.Wireless360Controller CFBundleInfoDictionaryVersion @@ -19,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 1.0.0d12 + ${CURRENT_PROJECT_VERSION} IOKitPersonalities Wireless360Controller diff --git a/Wireless360Controller/Wireless360Controller.cpp b/Wireless360Controller/Wireless360Controller.cpp index 88d0671..3d17921 100644 --- a/Wireless360Controller/Wireless360Controller.cpp +++ b/Wireless360Controller/Wireless360Controller.cpp @@ -26,7 +26,7 @@ #include "../360Controller/ControlStruct.h" #include "../360Controller/xbox360hid.h" -#define kDriverSettingKey "DeviceData" +#define kDriverSettingKey "DeviceData" OSDefineMetaClassAndStructors(Wireless360Controller, WirelessHIDDevice) #define super WirelessHIDDevice @@ -50,10 +50,10 @@ bool Wireless360Controller::init(OSDictionary *propTable) bool res = super::init(propTable); // Default settings - invertLeftX=invertLeftY=FALSE; - invertRightX=invertRightY=FALSE; - deadzoneLeft=deadzoneRight=0; - relativeLeft=relativeRight=FALSE; + invertLeftX = invertLeftY = false; + invertRightX = invertRightY = false; + deadzoneLeft = deadzoneRight = 0; + relativeLeft = relativeRight = false; readSettings(); // Done @@ -63,11 +63,10 @@ bool Wireless360Controller::init(OSDictionary *propTable) // Read the settings from the registry void Wireless360Controller::readSettings(void) { - OSDictionary *dataDictionary; OSBoolean *value; OSNumber *number; + OSDictionary *dataDictionary = OSDynamicCast(OSDictionary, getProperty(kDriverSettingKey)); - dataDictionary=OSDynamicCast(OSDictionary,getProperty(kDriverSettingKey)); if(dataDictionary==NULL) return; value=OSDynamicCast(OSBoolean,dataDictionary->getObject("InvertLeftX")); if(value!=NULL) invertLeftX=value->getValue(); @@ -85,12 +84,12 @@ void Wireless360Controller::readSettings(void) if(value!=NULL) relativeLeft=value->getValue(); value=OSDynamicCast(OSBoolean,dataDictionary->getObject("RelativeRight")); if(value!=NULL) relativeRight=value->getValue(); - /* +#if 0 IOLog("Xbox360ControllerClass preferences loaded:\n invertLeft X: %s, Y: %s\n invertRight X: %s, Y:%s\n deadzone Left: %d, Right: %d\n\n", invertLeftX?"True":"False",invertLeftY?"True":"False", invertRightX?"True":"False",invertRightY?"True":"False", deadzoneLeft,deadzoneRight); - */ +#endif } // Adjusts the report for any settings specified by the user @@ -153,19 +152,18 @@ void Wireless360Controller::receivedHIDupdate(unsigned char *data, int length) void Wireless360Controller::SetRumbleMotors(unsigned char large, unsigned char small) { - char buf[] = {0x00, 0x01, 0x0f, 0xc0, 0x00, large, small, 0x00, 0x00, 0x00, 0x00, 0x00}; - WirelessDevice *device; + unsigned char buf[] = {0x00, 0x01, 0x0f, 0xc0, 0x00, large, small, 0x00, 0x00, 0x00, 0x00, 0x00}; + WirelessDevice *device = OSDynamicCast(WirelessDevice, getProvider()); - device = OSDynamicCast(WirelessDevice, getProvider()); if (device != NULL) device->SendPacket(buf, sizeof(buf)); } - + IOReturn Wireless360Controller::setReport(IOMemoryDescriptor *report, IOHIDReportType reportType, IOOptionBits options) { char data[2]; -// IOLog("setReport(%p, %d, %d)\n", report, reportType, options); + // IOLog("setReport(%p, %d, %d)\n", report, reportType, options); if (report->readBytes(0, data, 2) < 2) return kIOReturnUnsupported; @@ -184,9 +182,8 @@ IOReturn Wireless360Controller::setReport(IOMemoryDescriptor *report, IOHIDRepor IOReturn Wireless360Controller::newReportDescriptor(IOMemoryDescriptor ** descriptor ) const { - IOBufferMemoryDescriptor *buffer; + IOBufferMemoryDescriptor *buffer = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, sizeof(ReportDescriptor)); - buffer = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, sizeof(ReportDescriptor)); if (buffer == NULL) return kIOReturnNoResources; buffer->writeBytes(0, ReportDescriptor, sizeof(ReportDescriptor)); @@ -197,9 +194,8 @@ IOReturn Wireless360Controller::newReportDescriptor(IOMemoryDescriptor ** descri // Called by the userspace IORegistryEntrySetCFProperties function IOReturn Wireless360Controller::setProperties(OSObject *properties) { - OSDictionary *dictionary; + OSDictionary *dictionary = OSDynamicCast(OSDictionary,properties); - dictionary=OSDynamicCast(OSDictionary,properties); if(dictionary!=NULL) { setProperty(kDriverSettingKey,dictionary); readSettings(); @@ -245,4 +241,3 @@ OSNumber* Wireless360Controller::newVendorIDNumber() const { return OSNumber::withNumber((unsigned long long)0x45e, 16); } - diff --git a/Wireless360Controller/Wireless360Controller.xcodeproj/project.pbxproj b/Wireless360Controller/Wireless360Controller.xcodeproj/project.pbxproj deleted file mode 100644 index 4a3d934..0000000 --- a/Wireless360Controller/Wireless360Controller.xcodeproj/project.pbxproj +++ /dev/null @@ -1,259 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 32D94FC60562CBF700B6AF17 /* Wireless360Controller.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A224C3EFF42367911CA2CB7 /* Wireless360Controller.h */; }; - 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; - 32D94FCA0562CBF700B6AF17 /* Wireless360Controller.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A224C3FFF42367911CA2CB7 /* Wireless360Controller.cpp */; settings = {ATTRIBUTES = (); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 1A224C3EFF42367911CA2CB7 /* Wireless360Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Wireless360Controller.h; sourceTree = ""; }; - 1A224C3FFF42367911CA2CB7 /* Wireless360Controller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Wireless360Controller.cpp; sourceTree = ""; }; - 32D94FCF0562CBF700B6AF17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 32D94FD00562CBF700B6AF17 /* Wireless360Controller.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Wireless360Controller.kext; sourceTree = BUILT_PRODUCTS_DIR; }; - 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 32D94FCB0562CBF700B6AF17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* Wireless360Controller */ = { - isa = PBXGroup; - children = ( - 247142CAFF3F8F9811CA285C /* Source */, - 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */, - 089C167CFE841241C02AAC07 /* Resources */, - 19C28FB6FE9D52B211CA2CBB /* Products */, - ); - name = Wireless360Controller; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 32D94FCF0562CBF700B6AF17 /* Info.plist */, - 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - ); - name = Resources; - sourceTree = ""; - }; - 19C28FB6FE9D52B211CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 32D94FD00562CBF700B6AF17 /* Wireless360Controller.kext */, - ); - name = Products; - sourceTree = ""; - }; - 247142CAFF3F8F9811CA285C /* Source */ = { - isa = PBXGroup; - children = ( - 1A224C3EFF42367911CA2CB7 /* Wireless360Controller.h */, - 1A224C3FFF42367911CA2CB7 /* Wireless360Controller.cpp */, - ); - name = Source; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 32D94FC50562CBF700B6AF17 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FC60562CBF700B6AF17 /* Wireless360Controller.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 32D94FC30562CBF700B6AF17 /* Wireless360Controller */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "Wireless360Controller" */; - buildPhases = ( - 32D94FC50562CBF700B6AF17 /* Headers */, - 32D94FC70562CBF700B6AF17 /* Resources */, - 32D94FC90562CBF700B6AF17 /* Sources */, - 32D94FCB0562CBF700B6AF17 /* Frameworks */, - 32D94FCC0562CBF700B6AF17 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Wireless360Controller; - productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - productName = Wireless360Controller; - productReference = 32D94FD00562CBF700B6AF17 /* Wireless360Controller.kext */; - productType = "com.apple.product-type.kernel-extension.iokit"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "Wireless360Controller" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 089C166AFE841209C02AAC07 /* Wireless360Controller */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 32D94FC30562CBF700B6AF17 /* Wireless360Controller */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 32D94FC70562CBF700B6AF17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 32D94FCC0562CBF700B6AF17 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 32D94FC90562CBF700B6AF17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FCA0562CBF700B6AF17 /* Wireless360Controller.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91DA08733DB10010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = com.mice.driver.Wireless360Controller; - MODULE_VERSION = 1.0.0d11; - PRODUCT_NAME = Wireless360Controller; - WRAPPER_EXTENSION = kext; - ZERO_LINK = YES; - }; - name = Debug; - }; - 1DEB91DB08733DB10010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = com.mice.driver.Wireless360Controller; - MODULE_VERSION = 1.0.0d11; - PRODUCT_NAME = Wireless360Controller; - WRAPPER_EXTENSION = kext; - }; - name = Release; - }; - 1DEB91DE08733DB10010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Debug; - }; - 1DEB91DF08733DB10010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PREBINDING = NO; - PROVISIONING_PROFILE = ""; - SDKROOT = ""; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "Wireless360Controller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91DA08733DB10010E9CD /* Debug */, - 1DEB91DB08733DB10010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "Wireless360Controller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91DE08733DB10010E9CD /* Debug */, - 1DEB91DF08733DB10010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/Wireless360Controller/version.plist b/Wireless360Controller/version.plist deleted file mode 100644 index 53bf3a3..0000000 --- a/Wireless360Controller/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 12 - CFBundleVersion - 1.0 - ProductBuildVersion - 7K571 - ProjectName - DevToolsWizardTemplates - SourceVersion - 3870000 - - diff --git a/WirelessGamingReceiver/English.lproj/InfoPlist.strings b/WirelessGamingReceiver/English.lproj/InfoPlist.strings index f180ed5..e85e4cf 100644 --- a/WirelessGamingReceiver/English.lproj/InfoPlist.strings +++ b/WirelessGamingReceiver/English.lproj/InfoPlist.strings @@ -1,3 +1,3 @@ /* Localized versions of Info.plist keys */ -NSHumanReadableCopyright = "© Colin Munro, 2007-11"; \ No newline at end of file +NSHumanReadableCopyright = "© Colin Munro, 2007-11"; diff --git a/WirelessGamingReceiver/IOKitDriver.pbproj/project.pbxproj b/WirelessGamingReceiver/IOKitDriver.pbproj/project.pbxproj deleted file mode 100644 index d24a1a0..0000000 --- a/WirelessGamingReceiver/IOKitDriver.pbproj/project.pbxproj +++ /dev/null @@ -1,311 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - 06AA1265FFB2107B11CA28AA = { - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OPTIMIZATION_CFLAGS = "-O0"; - ZERO_LINK = YES; - }; - isa = PBXBuildStyle; - name = Development; - }; - 06AA1266FFB2107B11CA28AA = { - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - ZERO_LINK = NO; - }; - isa = PBXBuildStyle; - name = Deployment; - }; -//060 -//061 -//062 -//063 -//064 -//080 -//081 -//082 -//083 -//084 - 089C1669FE841209C02AAC07 = { - buildSettings = { - }; - buildStyles = ( - 06AA1265FFB2107B11CA28AA, - 06AA1266FFB2107B11CA28AA, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = 089C166AFE841209C02AAC07; - projectDirPath = ""; - targets = ( - 32D94FC30562CBF700B6AF17, - ); - }; - 089C166AFE841209C02AAC07 = { - children = ( - 247142CAFF3F8F9811CA285C, - 8DA80CCF06AD972A00E5AC22, - 089C167CFE841241C02AAC07, - 19C28FB6FE9D52B211CA2CBB, - ); - isa = PBXGroup; - name = "«PROJECTNAME»"; - refType = 4; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 = { - children = ( - 32D94FCF0562CBF700B6AF17, - 089C167DFE841241C02AAC07, - ); - isa = PBXGroup; - name = Resources; - refType = 4; - sourceTree = ""; - }; - 089C167DFE841241C02AAC07 = { - children = ( - 089C167EFE841241C02AAC07, - ); - isa = PBXVariantGroup; - name = InfoPlist.strings; - refType = 4; - sourceTree = ""; - }; - 089C167EFE841241C02AAC07 = { - fileEncoding = 10; - isa = PBXFileReference; - lastKnownFileType = text.plist.strings; - name = English; - path = English.lproj/InfoPlist.strings; - refType = 4; - sourceTree = ""; - }; -//080 -//081 -//082 -//083 -//084 -//190 -//191 -//192 -//193 -//194 - 19C28FB6FE9D52B211CA2CBB = { - children = ( - 32D94FD00562CBF700B6AF17, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = ""; - }; -//190 -//191 -//192 -//193 -//194 -//1A0 -//1A1 -//1A2 -//1A3 -//1A4 - 1A224C3EFF42367911CA2CB7 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = file; - path = "«PROJECTNAMEASIDENTIFIER».h"; - refType = 4; - sourceTree = ""; - }; - 1A224C3FFF42367911CA2CB7 = { - fileEncoding = 4; - isa = PBXFileReference; - lastKnownFileType = file; - path = "«PROJECTNAMEASIDENTIFIER».cpp"; - refType = 4; - sourceTree = ""; - }; -//1A0 -//1A1 -//1A2 -//1A3 -//1A4 -//240 -//241 -//242 -//243 -//244 - 247142CAFF3F8F9811CA285C = { - children = ( - 1A224C3EFF42367911CA2CB7, - 1A224C3FFF42367911CA2CB7, - ); - isa = PBXGroup; - name = Source; - path = ""; - refType = 4; - sourceTree = ""; - }; -//240 -//241 -//242 -//243 -//244 -//320 -//321 -//322 -//323 -//324 - 32D94FC30562CBF700B6AF17 = { - buildPhases = ( - 32D94FC40562CBF700B6AF17, - 32D94FC50562CBF700B6AF17, - 32D94FC70562CBF700B6AF17, - 32D94FC90562CBF700B6AF17, - 32D94FCB0562CBF700B6AF17, - 32D94FCC0562CBF700B6AF17, - 32D94FCD0562CBF700B6AF17, - ); - buildRules = ( - ); - buildSettings = { - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = "com.yourcompany.driver.«PROJECTNAMEASIDENTIFIER»"; - MODULE_VERSION = 1.0.0d1; - PRODUCT_NAME = "«PROJECTNAME»"; - WRAPPER_EXTENSION = kext; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = "«PROJECTNAME»"; - productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - productName = "«PROJECTNAME»"; - productReference = 32D94FD00562CBF700B6AF17; - productType = "com.apple.product-type.kernel-extension.iokit"; - }; - 32D94FC40562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXShellScriptBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPreprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi"; - }; - 32D94FC50562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - 32D94FC60562CBF700B6AF17, - ); - isa = PBXHeadersBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FC60562CBF700B6AF17 = { - fileRef = 1A224C3EFF42367911CA2CB7; - isa = PBXBuildFile; - settings = { - }; - }; - 32D94FC70562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - 32D94FC80562CBF700B6AF17, - ); - isa = PBXResourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FC80562CBF700B6AF17 = { - fileRef = 089C167DFE841241C02AAC07; - isa = PBXBuildFile; - settings = { - }; - }; - 32D94FC90562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - 32D94FCA0562CBF700B6AF17, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FCA0562CBF700B6AF17 = { - fileRef = 1A224C3FFF42367911CA2CB7; - isa = PBXBuildFile; - settings = { - ATTRIBUTES = ( - ); - }; - }; - 32D94FCB0562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FCC0562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXRezBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - 32D94FCD0562CBF700B6AF17 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXShellScriptBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "script=\"${SYSTEM_DEVELOPER_DIR}/ProjectBuilder Extras/Kernel Extension Support/KEXTPostprocess\";\nif [ -x \"$script\" ]; then\n . \"$script\"\nfi"; - }; - 32D94FCF0562CBF700B6AF17 = { - isa = PBXFileReference; - lastKnownFileType = text.xml; - path = Info.plist; - refType = 4; - sourceTree = ""; - }; - 32D94FD00562CBF700B6AF17 = { - explicitFileType = wrapper.cfbundle; - includeInIndex = 0; - isa = PBXFileReference; - path = "«PROJECTNAME».kext"; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; -//320 -//321 -//322 -//323 -//324 -//8D0 -//8D1 -//8D2 -//8D3 -//8D4 - 8DA80CCF06AD972A00E5AC22 = { - isa = PBXFileReference; - lastKnownFileType = wrapper.framework; - name = Kernel.framework; - path = /System/Library/Frameworks/Kernel.framework; - refType = 0; - sourceTree = ""; - }; - }; - rootObject = 089C1669FE841209C02AAC07; -} diff --git a/WirelessGamingReceiver/Info.plist b/WirelessGamingReceiver/Info.plist index 819f678..03c5a22 100644 --- a/WirelessGamingReceiver/Info.plist +++ b/WirelessGamingReceiver/Info.plist @@ -6,8 +6,6 @@ English CFBundleExecutable ${EXECUTABLE_NAME} - CFBundleIconFile - CFBundleIdentifier com.mice.driver.WirelessGamingReceiver CFBundleInfoDictionaryVersion @@ -19,7 +17,7 @@ CFBundleSignature ???? CFBundleVersion - 1.0.0d12 + ${CURRENT_PROJECT_VERSION} IOKitPersonalities WirelessGamingReceiverForWindows diff --git a/WirelessGamingReceiver/WirelessDevice.h b/WirelessGamingReceiver/WirelessDevice.h index 83dee63..1815ef3 100644 --- a/WirelessGamingReceiver/WirelessDevice.h +++ b/WirelessGamingReceiver/WirelessDevice.h @@ -32,6 +32,7 @@ typedef void (*WirelessDeviceWatcher)(void *target, WirelessDevice *sender, void class WirelessDevice : public IOService { OSDeclareDefaultStructors(WirelessDevice); + public: bool init(OSDictionary *dictionary = 0); @@ -44,11 +45,11 @@ class WirelessDevice : public IOService void RegisterWatcher(void *target, WirelessDeviceWatcher function, void *parameter); OSNumber* newLocationIDNumber() const; + private: friend class WirelessGamingReceiver; void SetIndex(int i); void NewData(void); -private: int index; // callback void *target, *parameter; diff --git a/WirelessGamingReceiver/WirelessGamingReceiver.cpp b/WirelessGamingReceiver/WirelessGamingReceiver.cpp index 188745b..141640f 100644 --- a/WirelessGamingReceiver/WirelessGamingReceiver.cpp +++ b/WirelessGamingReceiver/WirelessGamingReceiver.cpp @@ -29,20 +29,18 @@ OSDefineMetaClassAndStructors(WirelessGamingReceiver, IOService) // Holds data for asynchronous reads -typedef struct +typedef struct WGRREAD { int index; IOBufferMemoryDescriptor *buffer; -} -WGRREAD; +} WGRREAD; // Get maximum packet size for a pipe static UInt32 GetMaxPacketSize(IOUSBPipe *pipe) { - const IOUSBEndpointDescriptor *ed; + const IOUSBEndpointDescriptor *ed = pipe->GetEndpointDescriptor(); - ed=pipe->GetEndpointDescriptor(); - if(ed==NULL) return 0; + if (ed == NULL) return 0; else return ed->wMaxPacketSize; } @@ -57,14 +55,14 @@ bool WirelessGamingReceiver::start(IOService *provider) if (!IOService::start(provider)) { -// IOLog("start - superclass failed\n"); + // IOLog("start - superclass failed\n"); return false; } device = OSDynamicCast(IOUSBDevice, provider); if (device == NULL) { -// IOLog("start - invalid provider\n"); + // IOLog("start - invalid provider\n"); goto fail; } @@ -72,7 +70,7 @@ bool WirelessGamingReceiver::start(IOService *provider) if (device->GetNumConfigurations() < 1) { device = NULL; -// IOLog("start - device has no configurations!\n"); + // IOLog("start - device has no configurations!\n"); goto fail; } @@ -81,22 +79,22 @@ bool WirelessGamingReceiver::start(IOService *provider) if (cd == NULL) { device = NULL; -// IOLog("start - couldn't get configuration descriptor\n"); + // IOLog("start - couldn't get configuration descriptor\n"); goto fail; } if (!device->open(this)) { device = NULL; -// IOLog("start - failed to open device\n"); + // IOLog("start - failed to open device\n"); goto fail; } if (device->SetConfiguration(this, cd->bConfigurationValue, true) != kIOReturnSuccess) { -// IOLog("start - unable to set configuration\n"); + // IOLog("start - unable to set configuration\n"); goto fail; } - + for (i = 0; i < WIRELESS_CONNECTIONS; i++) { connections[i].controller = NULL; @@ -122,12 +120,12 @@ bool WirelessGamingReceiver::start(IOService *provider) iOther = 0; while ((interface = device->FindNextInterface(interface, &interfaceRequest)) != NULL) { - switch(interface->GetInterfaceProtocol()) + switch (interface->GetInterfaceProtocol()) { case 129: // Controller if (!interface->open(this)) { -// IOLog("start: Failed to open control interface\n"); + // IOLog("start: Failed to open control interface\n"); goto fail; } connections[iConnection].controller = interface; @@ -135,7 +133,7 @@ bool WirelessGamingReceiver::start(IOService *provider) connections[iConnection].controllerIn = interface->FindNextPipe(NULL, &pipeRequest); if (connections[iConnection].controllerIn == NULL) { -// IOLog("start: Failed to open control input pipe\n"); + // IOLog("start: Failed to open control input pipe\n"); goto fail; } else @@ -144,17 +142,18 @@ bool WirelessGamingReceiver::start(IOService *provider) connections[iConnection].controllerOut = interface->FindNextPipe(NULL, &pipeRequest); if (connections[iConnection].controllerOut == NULL) { -// IOLog("start: Failed to open control output pipe\n"); + // IOLog("start: Failed to open control output pipe\n"); goto fail; } else connections[iConnection].controllerOut->retain(); iConnection++; break; + case 130: // It is a mystery if (!interface->open(this)) { -// IOLog("start: Failed to open mystery interface\n"); + // IOLog("start: Failed to open mystery interface\n"); goto fail; } connections[iOther].other = interface; @@ -162,7 +161,7 @@ bool WirelessGamingReceiver::start(IOService *provider) connections[iOther].otherIn = interface->FindNextPipe(NULL, &pipeRequest); if (connections[iOther].otherIn == NULL) { -// IOLog("start: Failed to open mystery input pipe\n"); + // IOLog("start: Failed to open mystery input pipe\n"); goto fail; } else @@ -171,15 +170,16 @@ bool WirelessGamingReceiver::start(IOService *provider) connections[iOther].otherOut = interface->FindNextPipe(NULL, &pipeRequest); if (connections[iOther].otherOut == NULL) { -// IOLog("start: Failed to open mystery output pipe\n"); + // IOLog("start: Failed to open mystery output pipe\n"); goto fail; } else connections[iOther].otherOut->retain(); iOther++; break; + default: -// IOLog("start: Ignoring interface (protocol %d)\n", interface->GetInterfaceProtocol()); + // IOLog("start: Ignoring interface (protocol %d)\n", interface->GetInterfaceProtocol()); break; } } @@ -193,17 +193,17 @@ bool WirelessGamingReceiver::start(IOService *provider) connections[i].inputArray = OSArray::withCapacity(5); if (connections[i].inputArray == NULL) { -// IOLog("start: Failed to allocate packet buffer %d\n", i); + // IOLog("start: Failed to allocate packet buffer %d\n", i); goto fail; } if (!QueueRead(i)) { -// IOLog("start: Failed to start read %d\n", i); + // IOLog("start: Failed to start read %d\n", i); goto fail; } } -// IOLog("start: Transform and roll out (%d interfaces)\n", connectionCount); + // IOLog("start: Transform and roll out (%d interfaces)\n", connectionCount); return true; fail: @@ -218,20 +218,31 @@ void WirelessGamingReceiver::stop(IOService *provider) IOService::stop(provider); } +// Handle termination +bool WirelessGamingReceiver::didTerminate(IOService *provider, IOOptionBits options, bool *defer) +{ + // release all objects used and close the device + ReleaseAll(); + return IOService::didTerminate(provider, options, defer); +} + + // Handle message from provider IOReturn WirelessGamingReceiver::message(UInt32 type,IOService *provider,void *argument) { -// IOLog("Message\n"); -/* + // IOLog("Message\n"); +#if 0 switch(type) { case kIOMessageServiceIsTerminated: case kIOMessageServiceIsRequestingClose: if(device->isOpen(this)) ReleaseAll(); return kIOReturnSuccess; default: - */ return IOService::message(type,provider,argument); -// } + } +#else + return IOService::message(type,provider,argument); +#endif } // Queue a read on a controller @@ -239,9 +250,8 @@ bool WirelessGamingReceiver::QueueRead(int index) { IOUSBCompletion complete; IOReturn err; - WGRREAD *data; + WGRREAD *data = (WGRREAD*)IOMalloc(sizeof(WGRREAD)); - data = (WGRREAD*)IOMalloc(sizeof(WGRREAD)); if (data == NULL) return false; data->index = index; @@ -263,7 +273,7 @@ bool WirelessGamingReceiver::QueueRead(int index) data->buffer->release(); IOFree(data, sizeof(WGRREAD)); -// IOLog("read - failed to start (0x%.8x)\n", err); + // IOLog("read - failed to start (0x%.8x)\n", err); return false; } @@ -276,14 +286,15 @@ void WirelessGamingReceiver::ReadComplete(void *parameter, IOReturn status, UInt switch (status) { case kIOReturnOverrun: -// IOLog("read - kIOReturnOverrun, clearing stall\n"); + // IOLog("read - kIOReturnOverrun, clearing stall\n"); connections[data->index].controllerIn->ClearStall(); // fall through case kIOReturnSuccess: ProcessMessage(data->index, (unsigned char*)data->buffer->getBytesNoCopy(), (int)data->buffer->getLength() - bufferSizeRemaining); break; + case kIOReturnNotResponding: -// IOLog("read - kIOReturnNotResponding\n"); + // IOLog("read - kIOReturnNotResponding\n"); // fall through default: reread = false; @@ -308,7 +319,7 @@ bool WirelessGamingReceiver::QueueWrite(int index, const void *bytes, UInt32 len outBuffer = IOBufferMemoryDescriptor::inTaskWithOptions(kernel_task, 0, length); if (outBuffer == NULL) { -// IOLog("send - unable to allocate buffer\n"); + // IOLog("send - unable to allocate buffer\n"); return false; } outBuffer->writeBytes(0, bytes, length); @@ -322,7 +333,7 @@ bool WirelessGamingReceiver::QueueWrite(int index, const void *bytes, UInt32 len return true; else { -// IOLog("send - failed to start (0x%.8x)\n",err); + // IOLog("send - failed to start (0x%.8x)\n",err); return false; } } @@ -340,9 +351,7 @@ void WirelessGamingReceiver::WriteComplete(void *parameter,IOReturn status,UInt3 // Release any allocated objects void WirelessGamingReceiver::ReleaseAll(void) { - int i; - - for (i = 0; i < connectionCount; i++) + for (int i = 0; i < connectionCount; i++) { if (connections[i].service != NULL) { @@ -471,7 +480,7 @@ void WirelessGamingReceiver::ProcessMessage(int index, const unsigned char *data ready = true; } InstantiateService(index); - if (ready) + if (ready && connections[index].service != NULL) { #ifdef PROTOCOL_DEBUG IOLog("Registering wireless device"); @@ -528,17 +537,17 @@ void WirelessGamingReceiver::InstantiateService(int index) { connections[index].service->attach(this); connections[index].service->SetIndex(index); -// connections[index].service->registerService(); -// IOLog("process: Device attached\n"); + // connections[index].service->registerService(); + // IOLog("process: Device attached\n"); if (IsDataQueued(index)) connections[index].service->NewData(); - connections[index].service->start(this); + connections[index].service->start(this); } else { connections[index].service->release(); connections[index].service = NULL; -// IOLog("process: Device attach failure\n"); + // IOLog("process: Device attach failure\n"); } } } diff --git a/WirelessGamingReceiver/WirelessGamingReceiver.h b/WirelessGamingReceiver/WirelessGamingReceiver.h index 41c65d6..13135ab 100644 --- a/WirelessGamingReceiver/WirelessGamingReceiver.h +++ b/WirelessGamingReceiver/WirelessGamingReceiver.h @@ -31,7 +31,7 @@ class WirelessDevice; -typedef struct +typedef struct WIRELESS_CONNECTION { // Controller IOUSBInterface *controller; @@ -81,6 +81,8 @@ class WirelessGamingReceiver : public IOService void WriteComplete(void *parameter, IOReturn status, UInt32 bufferSizeRemaining); void ReleaseAll(void); + + bool didTerminate(IOService *provider, IOOptionBits options, bool *defer); static void _ReadComplete(void *target, void *parameter, IOReturn status, UInt32 bufferSizeRemaining); static void _WriteComplete(void *target, void *parameter, IOReturn status, UInt32 bufferSizeRemaining); diff --git a/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj/colin.mode1 b/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj/colin.mode1 deleted file mode 100644 index 6405cf0..0000000 --- a/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj/colin.mode1 +++ /dev/null @@ -1,1564 +0,0 @@ - - - - - ActivePerspectiveName - Project - AllowedModules - - - BundleLoadPath - - MaxInstances - n - Module - PBXSmartGroupTreeModule - Name - Groups and Files Outline View - - - BundleLoadPath - - MaxInstances - n - Module - PBXNavigatorGroup - Name - Editor - - - BundleLoadPath - - MaxInstances - n - Module - XCTaskListModule - Name - Task List - - - BundleLoadPath - - MaxInstances - n - Module - XCDetailModule - Name - File and Smart Group Detail Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXBuildResultsModule - Name - Detailed Build Results Viewer - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXProjectFindModule - Name - Project Batch Find Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXRunSessionModule - Name - Run Log - - - BundleLoadPath - - MaxInstances - n - Module - PBXBookmarksModule - Name - Bookmarks Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXClassBrowserModule - Name - Class Browser - - - BundleLoadPath - - MaxInstances - n - Module - PBXCVSModule - Name - Source Code Control Tool - - - BundleLoadPath - - MaxInstances - n - Module - PBXDebugBreakpointsModule - Name - Debug Breakpoints Tool - - - BundleLoadPath - - MaxInstances - n - Module - XCDockableInspector - Name - Inspector - - - BundleLoadPath - - MaxInstances - n - Module - PBXOpenQuicklyModule - Name - Open Quickly Tool - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugSessionModule - Name - Debugger - - - BundleLoadPath - - MaxInstances - 1 - Module - PBXDebugCLIModule - Name - Debug Console - - - Description - DefaultDescriptionKey - DockingSystemVisible - - Extension - mode1 - FavBarConfig - - PBXProjectModuleGUID - 3B21EBD60B8CEAED00B5CACA - XCBarModuleItemNames - - XCBarModuleItems - - - FirstTimeWindowDisplayed - - Identifier - com.apple.perspectives.project.mode1 - MajorVersion - 31 - MinorVersion - 1 - Name - Default - Notifications - - OpenEditors - - - Content - - PBXProjectModuleGUID - 3BE527360BDC379700984E1F - PBXProjectModuleLabel - WirelessGamingReceiver.cpp - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 3BE527370BDC379700984E1F - PBXProjectModuleLabel - WirelessGamingReceiver.cpp - _historyCapacity - 0 - bookmark - 3BD5A2FD0C56D76C005B4E24 - history - - 3BD5A2FC0C56D76C005B4E24 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {806, 677}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 38 258 806 718 0 0 1280 1002 - - - - Content - - PBXProjectModuleGUID - 3B54B4630BDA9ECF00329AC0 - PBXProjectModuleLabel - WirelessHIDDevice.cpp - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 3B54B4640BDA9ECF00329AC0 - PBXProjectModuleLabel - WirelessHIDDevice.cpp - _historyCapacity - 0 - bookmark - 3BD5A2FE0C56D76C005B4E24 - history - - 3B4FC9F60C49C3B3007CF491 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {1059, 503}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 34 458 1059 544 0 0 1280 1002 - - - - Content - - PBXProjectModuleGUID - 3BD1A9390C49BC33006510F7 - PBXProjectModuleLabel - WirelessHIDDevice.h - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 3BD1A93A0C49BC33006510F7 - PBXProjectModuleLabel - WirelessHIDDevice.h - _historyCapacity - 0 - bookmark - 3BD5A2FF0C56D76C005B4E24 - history - - 3B4FC9F70C49C3B3007CF491 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {1059, 503}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 155 150 1059 544 0 0 1280 1002 - - - - Content - - PBXProjectModuleGUID - 3B216B380C08E9A4000BE7F3 - PBXProjectModuleLabel - WirelessGamingReceiver.h - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 3B216B390C08E9A4000BE7F3 - PBXProjectModuleLabel - WirelessGamingReceiver.h - _historyCapacity - 0 - bookmark - 3BD5A3000C56D76C005B4E24 - history - - 3B4FC9F80C49C3B3007CF491 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {688, 361}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 481 168 688 402 0 0 1280 1002 - - - - Content - - PBXProjectModuleGUID - 3B216B3B0C08E9A4000BE7F3 - PBXProjectModuleLabel - IOUSBDevice.cpp - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 3B216B3C0C08E9A4000BE7F3 - PBXProjectModuleLabel - IOUSBDevice.cpp - _historyCapacity - 0 - bookmark - 3BD5A3010C56D76C005B4E24 - history - - 3B4FC9F90C49C3B3007CF491 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {806, 677}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 61 237 806 718 0 0 1280 1002 - - - - Content - - PBXProjectModuleGUID - 3B216B410C08E9A4000BE7F3 - PBXProjectModuleLabel - WirelessDevice.h - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 3B216B420C08E9A4000BE7F3 - PBXProjectModuleLabel - WirelessDevice.h - _historyCapacity - 0 - bookmark - 3BD5A3030C56D76C005B4E24 - history - - 3B4FC9FB0C49C3B3007CF491 - - - SplitCount - 1 - - StatusBarVisibility - - - Geometry - - Frame - {{0, 20}, {1059, 503}} - PBXModuleWindowStatusBarHidden2 - - RubberWindowFrame - 175 169 1059 544 0 0 1280 1002 - - - - PerspectiveWidths - - -1 - -1 - - Perspectives - - - ChosenToolbarItems - - active-target-popup - active-buildstyle-popup - action - NSToolbarFlexibleSpaceItem - buildOrClean - build-and-runOrDebug - com.apple.ide.PBXToolbarStopButton - get-info - toggle-editor - NSToolbarFlexibleSpaceItem - com.apple.pbx.toolbar.searchfield - - ControllerClassBaseName - - IconName - WindowOfProjectWithEditor - Identifier - perspective.project - IsVertical - - Layout - - - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 089C166AFE841209C02AAC07 - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 338}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 356}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 7 576 690 397 0 0 1280 1002 - - Module - PBXSmartGroupTreeModule - Proportion - 203pt - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20306471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1CE0B20406471E060097A5F4 - PBXProjectModuleLabel - MyNewFile14.java - - SplitCount - 1 - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {482, 0}} - RubberWindowFrame - 7 576 690 397 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - - ContentConfiguration - - PBXProjectModuleGUID - 1CE0B20506471E060097A5F4 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{0, 5}, {482, 351}} - RubberWindowFrame - 7 576 690 397 0 0 1280 1002 - - Module - XCDetailModule - Proportion - 351pt - - - Proportion - 482pt - - - Name - Project - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - XCModuleDock - PBXNavigatorGroup - XCDetailModule - - TableOfContents - - 3BD5A2FA0C56D76C005B4E24 - 1CE0B1FE06471DED0097A5F4 - 3BD5A2FB0C56D76C005B4E24 - 1CE0B20306471E060097A5F4 - 1CE0B20506471E060097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default - - - ControllerClassBaseName - - IconName - WindowOfProject - Identifier - perspective.morph - IsVertical - 0 - Layout - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C37FBAC04509CD000000102 - 1C37FAAC04509CD000000102 - 1C08E77C0454961000C914BD - 1C37FABC05509CD000000102 - 1C37FABC05539CD112110102 - E2644B35053B69B200211256 - 1C37FABC04509CD000100104 - 1CC0EA4004350EF90044410B - 1CC0EA4004350EF90041110B - - PBXProjectModuleGUID - 11E0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - yes - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 186 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 29B97314FDCFA39411CA2CEA - 1C37FABC05509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {186, 337}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 1 - XCSharingToken - com.apple.Xcode.GFSharingToken - - GeometryConfiguration - - Frame - {{0, 0}, {203, 355}} - GroupTreeTableConfiguration - - MainColumn - 186 - - RubberWindowFrame - 373 269 690 397 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 100% - - - Name - Morph - PreferredWidth - 300 - ServiceClasses - - XCModuleDock - PBXSmartGroupTreeModule - - TableOfContents - - 11E0B1FE06471DED0097A5F4 - - ToolbarConfiguration - xcode.toolbar.config.default.short - - - PerspectivesBarVisible - - ShelfIsVisible - - SourceDescription - file at '/System/Library/PrivateFrameworks/DevToolsInterface.framework/Versions/A/Resources/XCPerspectivesSpecificationMode1.xcperspec' - StatusbarIsVisible - - TimeStamp - 0.0 - ToolbarDisplayMode - 1 - ToolbarIsVisible - - ToolbarSizeMode - 1 - Type - Perspectives - UpdateMessage - The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? - WindowJustification - 5 - WindowOrderList - - 3B21ED2D0B8E33A000B5CACA - 3B216B410C08E9A4000BE7F3 - 3B216B3B0C08E9A4000BE7F3 - 3B216B380C08E9A4000BE7F3 - 3BD1A9390C49BC33006510F7 - 3B54B4630BDA9ECF00329AC0 - /Users/colin/Projects2/OSX/360 Controller/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj - 3BE527360BDC379700984E1F - - WindowString - 7 576 690 397 0 0 1280 1002 - WindowTools - - - FirstTimeWindowDisplayed - - Identifier - windowTool.build - IsVertical - - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528F0623707200166675 - PBXProjectModuleLabel - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {668, 312}} - RubberWindowFrame - 36 380 668 594 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 312pt - - - ContentConfiguration - - PBXProjectModuleGUID - XCMainBuildResultsModuleGUID - PBXProjectModuleLabel - Build - XCBuildResultsTrigger_Collapse - 1021 - XCBuildResultsTrigger_Open - 1011 - - GeometryConfiguration - - Frame - {{0, 317}, {668, 236}} - RubberWindowFrame - 36 380 668 594 0 0 1280 1002 - - Module - PBXBuildResultsModule - Proportion - 236pt - - - Proportion - 553pt - - - Name - Build Results - ServiceClasses - - PBXBuildResultsModule - - StatusbarIsVisible - - TableOfContents - - 3B21ED2D0B8E33A000B5CACA - 3BD5A3040C56D76C005B4E24 - 1CD0528F0623707200166675 - XCMainBuildResultsModuleGUID - - ToolbarConfiguration - xcode.toolbar.config.build - WindowString - 36 380 668 594 0 0 1280 1002 - WindowToolGUID - 3B21ED2D0B8E33A000B5CACA - WindowToolIsVisible - - - - Identifier - windowTool.debugger - Layout - - - Dock - - - ContentConfiguration - - Debugger - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {317, 164}} - {{317, 0}, {377, 164}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {694, 164}} - {{0, 164}, {694, 216}} - - - - LauncherConfigVersion - 8 - PBXProjectModuleGUID - 1C162984064C10D400B95A72 - PBXProjectModuleLabel - Debug - GLUTExamples (Underwater) - - GeometryConfiguration - - DebugConsoleDrawerSize - {100, 120} - DebugConsoleVisible - None - DebugConsoleWindowFrame - {{200, 200}, {500, 300}} - DebugSTDIOWindowFrame - {{200, 200}, {500, 300}} - Frame - {{0, 0}, {694, 380}} - RubberWindowFrame - 321 238 694 422 0 0 1440 878 - - Module - PBXDebugSessionModule - Proportion - 100% - - - Proportion - 100% - - - Name - Debugger - ServiceClasses - - PBXDebugSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CD10A99069EF8BA00B06720 - 1C0AD2AB069F1E9B00FABCE6 - 1C162984064C10D400B95A72 - 1C0AD2AC069F1E9B00FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.debug - WindowString - 321 238 694 422 0 0 1440 878 - WindowToolGUID - 1CD10A99069EF8BA00B06720 - WindowToolIsVisible - 0 - - - FirstTimeWindowDisplayed - - Identifier - windowTool.find - IsVertical - - Layout - - - Dock - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1CDD528C0622207200134675 - PBXProjectModuleLabel - - StatusBarVisibility - - - GeometryConfiguration - - Frame - {{0, 0}, {781, 212}} - RubberWindowFrame - 53 509 781 470 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 781pt - - - Proportion - 212pt - - - BecomeActive - - ContentConfiguration - - PBXProjectModuleGUID - 1CD0528E0623707200166675 - PBXProjectModuleLabel - Project Find - - GeometryConfiguration - - Frame - {{0, 217}, {781, 212}} - RubberWindowFrame - 53 509 781 470 0 0 1280 1002 - - Module - PBXProjectFindModule - Proportion - 212pt - - - Proportion - 429pt - - - Name - Project Find - ServiceClasses - - PBXProjectFindModule - - StatusbarIsVisible - - TableOfContents - - 1C530D57069F1CE1000CFCEE - 3BCC40340BDA6D7200B1619B - 3BCC40350BDA6D7200B1619B - 1CDD528C0622207200134675 - 1CD0528E0623707200166675 - - WindowString - 53 509 781 470 0 0 1280 1002 - WindowToolGUID - 1C530D57069F1CE1000CFCEE - WindowToolIsVisible - - - - Identifier - MENUSEPARATOR - - - Identifier - windowTool.debuggerConsole - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAAC065D492600B07095 - PBXProjectModuleLabel - Debugger Console - - GeometryConfiguration - - Frame - {{0, 0}, {440, 358}} - RubberWindowFrame - 650 41 440 400 0 0 1280 1002 - - Module - PBXDebugCLIModule - Proportion - 358pt - - - Proportion - 358pt - - - Name - Debugger Console - ServiceClasses - - PBXDebugCLIModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAAD065D492600B07095 - 1C78EAAE065D492600B07095 - 1C78EAAC065D492600B07095 - - WindowString - 650 41 440 400 0 0 1280 1002 - - - Identifier - windowTool.run - Layout - - - Dock - - - ContentConfiguration - - LauncherConfigVersion - 3 - PBXProjectModuleGUID - 1CD0528B0623707200166675 - PBXProjectModuleLabel - Run - Runner - - HorizontalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {493, 167}} - {{0, 176}, {493, 267}} - - - VerticalSplitView - - _collapsingFrameDimension - 0.0 - _indexOfCollapsedView - 0 - _percentageOfCollapsedView - 0.0 - isCollapsed - yes - sizes - - {{0, 0}, {405, 443}} - {{414, 0}, {514, 443}} - - - - - GeometryConfiguration - - Frame - {{0, 0}, {460, 159}} - RubberWindowFrame - 316 696 459 200 0 0 1280 1002 - - Module - PBXRunSessionModule - Proportion - 159pt - - - Proportion - 159pt - - - Name - Run Log - ServiceClasses - - PBXRunSessionModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C0AD2B3069F1EA900FABCE6 - 1C0AD2B4069F1EA900FABCE6 - 1CD0528B0623707200166675 - 1C0AD2B5069F1EA900FABCE6 - - ToolbarConfiguration - xcode.toolbar.config.run - WindowString - 316 696 459 200 0 0 1280 1002 - WindowToolGUID - 1C0AD2B3069F1EA900FABCE6 - WindowToolIsVisible - 0 - - - Identifier - windowTool.scm - Layout - - - Dock - - - ContentConfiguration - - PBXProjectModuleGUID - 1C78EAB2065D492600B07095 - PBXProjectModuleLabel - <No Editor> - PBXSplitModuleInNavigatorKey - - Split0 - - PBXProjectModuleGUID - 1C78EAB3065D492600B07095 - - SplitCount - 1 - - StatusBarVisibility - 1 - - GeometryConfiguration - - Frame - {{0, 0}, {452, 0}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - - Module - PBXNavigatorGroup - Proportion - 0pt - - - BecomeActive - 1 - ContentConfiguration - - PBXProjectModuleGUID - 1CD052920623707200166675 - PBXProjectModuleLabel - SCM - - GeometryConfiguration - - ConsoleFrame - {{0, 259}, {452, 0}} - Frame - {{0, 7}, {452, 259}} - RubberWindowFrame - 743 379 452 308 0 0 1280 1002 - TableConfiguration - - Status - 30 - FileName - 199 - Path - 197.09500122070312 - - TableFrame - {{0, 0}, {452, 250}} - - Module - PBXCVSModule - Proportion - 262pt - - - Proportion - 266pt - - - Name - SCM - ServiceClasses - - PBXCVSModule - - StatusbarIsVisible - 1 - TableOfContents - - 1C78EAB4065D492600B07095 - 1C78EAB5065D492600B07095 - 1C78EAB2065D492600B07095 - 1CD052920623707200166675 - - ToolbarConfiguration - xcode.toolbar.config.scm - WindowString - 743 379 452 308 0 0 1280 1002 - - - Identifier - windowTool.breakpoints - IsVertical - 0 - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - PBXBottomSmartGroupGIDs - - 1C77FABC04509CD000000102 - - PBXProjectModuleGUID - 1CE0B1FE06471DED0097A5F4 - PBXProjectModuleLabel - Files - PBXProjectStructureProvided - no - PBXSmartGroupTreeModuleColumnData - - PBXSmartGroupTreeModuleColumnWidthsKey - - 168 - - PBXSmartGroupTreeModuleColumnsKey_v4 - - MainColumn - - - PBXSmartGroupTreeModuleOutlineStateKey_v7 - - PBXSmartGroupTreeModuleOutlineStateExpansionKey - - 1C77FABC04509CD000000102 - - PBXSmartGroupTreeModuleOutlineStateSelectionKey - - - 0 - - - PBXSmartGroupTreeModuleOutlineStateVisibleRectKey - {{0, 0}, {168, 350}} - - PBXTopSmartGroupGIDs - - XCIncludePerspectivesSwitch - 0 - - GeometryConfiguration - - Frame - {{0, 0}, {185, 368}} - GroupTreeTableConfiguration - - MainColumn - 168 - - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - PBXSmartGroupTreeModule - Proportion - 185pt - - - ContentConfiguration - - PBXProjectModuleGUID - 1CA1AED706398EBD00589147 - PBXProjectModuleLabel - Detail - - GeometryConfiguration - - Frame - {{190, 0}, {554, 368}} - RubberWindowFrame - 315 424 744 409 0 0 1440 878 - - Module - XCDetailModule - Proportion - 554pt - - - Proportion - 368pt - - - MajorVersion - 2 - MinorVersion - 0 - Name - Breakpoints - ServiceClasses - - PBXSmartGroupTreeModule - XCDetailModule - - StatusbarIsVisible - 1 - TableOfContents - - 1CDDB66807F98D9800BB5817 - 1CDDB66907F98D9800BB5817 - 1CE0B1FE06471DED0097A5F4 - 1CA1AED706398EBD00589147 - - ToolbarConfiguration - xcode.toolbar.config.breakpoints - WindowString - 315 424 744 409 0 0 1440 878 - WindowToolGUID - 1CDDB66807F98D9800BB5817 - WindowToolIsVisible - 1 - - - Identifier - windowTool.debugAnimator - Layout - - - Dock - - - Module - PBXNavigatorGroup - Proportion - 100% - - - Proportion - 100% - - - Name - Debug Visualizer - ServiceClasses - - PBXNavigatorGroup - - StatusbarIsVisible - 1 - ToolbarConfiguration - xcode.toolbar.config.debugAnimator - WindowString - 100 100 700 500 0 0 1280 1002 - - - Identifier - windowTool.bookmarks - Layout - - - Dock - - - Module - PBXBookmarksModule - Proportion - 100% - - - Proportion - 100% - - - Name - Bookmarks - ServiceClasses - - PBXBookmarksModule - - StatusbarIsVisible - 0 - WindowString - 538 42 401 187 0 0 1280 1002 - - - Identifier - windowTool.classBrowser - Layout - - - Dock - - - BecomeActive - 1 - ContentConfiguration - - OptionsSetName - Hierarchy, all classes - PBXProjectModuleGUID - 1CA6456E063B45B4001379D8 - PBXProjectModuleLabel - Class Browser - NSObject - - GeometryConfiguration - - ClassesFrame - {{0, 0}, {374, 96}} - ClassesTreeTableConfiguration - - PBXClassNameColumnIdentifier - 208 - PBXClassBookColumnIdentifier - 22 - - Frame - {{0, 0}, {630, 331}} - MembersFrame - {{0, 105}, {374, 395}} - MembersTreeTableConfiguration - - PBXMemberTypeIconColumnIdentifier - 22 - PBXMemberNameColumnIdentifier - 216 - PBXMemberTypeColumnIdentifier - 97 - PBXMemberBookColumnIdentifier - 22 - - PBXModuleWindowStatusBarHidden2 - 1 - RubberWindowFrame - 385 179 630 352 0 0 1440 878 - - Module - PBXClassBrowserModule - Proportion - 332pt - - - Proportion - 332pt - - - Name - Class Browser - ServiceClasses - - PBXClassBrowserModule - - StatusbarIsVisible - 0 - TableOfContents - - 1C0AD2AF069F1E9B00FABCE6 - 1C0AD2B0069F1E9B00FABCE6 - 1CA6456E063B45B4001379D8 - - ToolbarConfiguration - xcode.toolbar.config.classbrowser - WindowString - 385 179 630 352 0 0 1440 878 - WindowToolGUID - 1C0AD2AF069F1E9B00FABCE6 - WindowToolIsVisible - 0 - - - - diff --git a/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj/project.pbxproj b/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj/project.pbxproj deleted file mode 100644 index cefc679..0000000 --- a/WirelessGamingReceiver/WirelessGamingReceiver.xcodeproj/project.pbxproj +++ /dev/null @@ -1,280 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 32D94FC60562CBF700B6AF17 /* WirelessGamingReceiver.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A224C3EFF42367911CA2CB7 /* WirelessGamingReceiver.h */; }; - 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; }; - 32D94FCA0562CBF700B6AF17 /* WirelessGamingReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A224C3FFF42367911CA2CB7 /* WirelessGamingReceiver.cpp */; settings = {ATTRIBUTES = (); }; }; - 3B21ED670B8E688A00B5CACA /* WirelessDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 3B21ED660B8E688A00B5CACA /* WirelessDevice.h */; }; - 3B21ED6C0B8E690F00B5CACA /* WirelessDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3B21ED6B0B8E690F00B5CACA /* WirelessDevice.cpp */; }; - 3BE667180B9109C5009679FC /* WirelessHIDDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BE667170B9109C5009679FC /* WirelessHIDDevice.h */; }; - 3BE6671C0B910A02009679FC /* WirelessHIDDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3BE6671B0B910A02009679FC /* WirelessHIDDevice.cpp */; }; - 3BE6677B0B91DC55009679FC /* devices.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BE6677A0B91DC55009679FC /* devices.h */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 1A224C3EFF42367911CA2CB7 /* WirelessGamingReceiver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WirelessGamingReceiver.h; sourceTree = ""; }; - 1A224C3FFF42367911CA2CB7 /* WirelessGamingReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WirelessGamingReceiver.cpp; sourceTree = ""; }; - 32D94FCF0562CBF700B6AF17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 32D94FD00562CBF700B6AF17 /* WirelessGamingReceiver.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WirelessGamingReceiver.kext; sourceTree = BUILT_PRODUCTS_DIR; }; - 3B21ED660B8E688A00B5CACA /* WirelessDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WirelessDevice.h; sourceTree = ""; }; - 3B21ED6B0B8E690F00B5CACA /* WirelessDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WirelessDevice.cpp; sourceTree = ""; }; - 3BE667170B9109C5009679FC /* WirelessHIDDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WirelessHIDDevice.h; sourceTree = ""; }; - 3BE6671B0B910A02009679FC /* WirelessHIDDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WirelessHIDDevice.cpp; sourceTree = ""; }; - 3BE6677A0B91DC55009679FC /* devices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = devices.h; sourceTree = ""; }; - 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 32D94FCB0562CBF700B6AF17 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 089C166AFE841209C02AAC07 /* WirelessGamingReceiver */ = { - isa = PBXGroup; - children = ( - 247142CAFF3F8F9811CA285C /* Source */, - 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */, - 089C167CFE841241C02AAC07 /* Resources */, - 19C28FB6FE9D52B211CA2CBB /* Products */, - ); - name = WirelessGamingReceiver; - sourceTree = ""; - }; - 089C167CFE841241C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 32D94FCF0562CBF700B6AF17 /* Info.plist */, - 089C167DFE841241C02AAC07 /* InfoPlist.strings */, - ); - name = Resources; - sourceTree = ""; - }; - 19C28FB6FE9D52B211CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 32D94FD00562CBF700B6AF17 /* WirelessGamingReceiver.kext */, - ); - name = Products; - sourceTree = ""; - }; - 247142CAFF3F8F9811CA285C /* Source */ = { - isa = PBXGroup; - children = ( - 3BE6677A0B91DC55009679FC /* devices.h */, - 3BE6671B0B910A02009679FC /* WirelessHIDDevice.cpp */, - 3BE667170B9109C5009679FC /* WirelessHIDDevice.h */, - 3B21ED6B0B8E690F00B5CACA /* WirelessDevice.cpp */, - 3B21ED660B8E688A00B5CACA /* WirelessDevice.h */, - 1A224C3FFF42367911CA2CB7 /* WirelessGamingReceiver.cpp */, - 1A224C3EFF42367911CA2CB7 /* WirelessGamingReceiver.h */, - ); - name = Source; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 32D94FC50562CBF700B6AF17 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FC60562CBF700B6AF17 /* WirelessGamingReceiver.h in Headers */, - 3B21ED670B8E688A00B5CACA /* WirelessDevice.h in Headers */, - 3BE667180B9109C5009679FC /* WirelessHIDDevice.h in Headers */, - 3BE6677B0B91DC55009679FC /* devices.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 32D94FC30562CBF700B6AF17 /* WirelessGamingReceiver */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "WirelessGamingReceiver" */; - buildPhases = ( - 32D94FC50562CBF700B6AF17 /* Headers */, - 32D94FC70562CBF700B6AF17 /* Resources */, - 32D94FC90562CBF700B6AF17 /* Sources */, - 32D94FCB0562CBF700B6AF17 /* Frameworks */, - 32D94FCC0562CBF700B6AF17 /* Rez */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = WirelessGamingReceiver; - productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - productName = WirelessGamingReceiver; - productReference = 32D94FD00562CBF700B6AF17 /* WirelessGamingReceiver.kext */; - productType = "com.apple.product-type.kernel-extension.iokit"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 089C1669FE841209C02AAC07 /* Project object */ = { - isa = PBXProject; - buildConfigurationList = 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "WirelessGamingReceiver" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 089C166AFE841209C02AAC07 /* WirelessGamingReceiver */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 32D94FC30562CBF700B6AF17 /* WirelessGamingReceiver */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 32D94FC70562CBF700B6AF17 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - 32D94FCC0562CBF700B6AF17 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 32D94FC90562CBF700B6AF17 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 32D94FCA0562CBF700B6AF17 /* WirelessGamingReceiver.cpp in Sources */, - 3B21ED6C0B8E690F00B5CACA /* WirelessDevice.cpp in Sources */, - 3BE6671C0B910A02009679FC /* WirelessHIDDevice.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C167EFE841241C02AAC07 /* English */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91DA08733DB10010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = com.mice.driver.WirelessGamingReceiver; - MODULE_VERSION = 1.0.0d11; - PRODUCT_NAME = WirelessGamingReceiver; - PROVISIONING_PROFILE = ""; - WRAPPER_EXTENSION = kext; - ZERO_LINK = YES; - }; - name = Debug; - }; - 1DEB91DB08733DB10010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Developer ID Application: Colin Munro"; - CURRENT_PROJECT_VERSION = 1.0.0d12; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_MODEL_TUNING = G5; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions"; - MODULE_NAME = com.mice.driver.WirelessGamingReceiver; - MODULE_VERSION = 1.0.0d11; - PRODUCT_NAME = WirelessGamingReceiver; - PROVISIONING_PROFILE = ""; - WRAPPER_EXTENSION = kext; - }; - name = Release; - }; - 1DEB91DE08733DB10010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = ""; - PREBINDING = NO; - SDKROOT = ""; - }; - name = Debug; - }; - 1DEB91DF08733DB10010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.5; - PREBINDING = NO; - SDKROOT = ""; - SYMROOT = build; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "WirelessGamingReceiver" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91DA08733DB10010E9CD /* Debug */, - 1DEB91DB08733DB10010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "WirelessGamingReceiver" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91DE08733DB10010E9CD /* Debug */, - 1DEB91DF08733DB10010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 089C1669FE841209C02AAC07 /* Project object */; -} diff --git a/WirelessGamingReceiver/WirelessHIDDevice.cpp b/WirelessGamingReceiver/WirelessHIDDevice.cpp index db7a1d0..dd4e437 100644 --- a/WirelessGamingReceiver/WirelessHIDDevice.cpp +++ b/WirelessGamingReceiver/WirelessHIDDevice.cpp @@ -26,7 +26,7 @@ #include "WirelessDevice.h" #include "devices.h" -#define POWEROFF_TIMEOUT (2 * 60) +#define POWEROFF_TIMEOUT (15 * 60) OSDefineMetaClassAndAbstractStructors(WirelessHIDDevice, IOHIDDevice) #define super IOHIDDevice @@ -36,9 +36,8 @@ const char weirdStart[] = {0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, void WirelessHIDDevice::ChatPadTimerActionWrapper(OSObject *owner, IOTimerEventSource *sender) { - WirelessHIDDevice *device; + WirelessHIDDevice *device = OSDynamicCast(WirelessHIDDevice, owner); - device = OSDynamicCast(WirelessHIDDevice, owner); // Automatic shutoff device->serialTimerCount++; if (device->serialTimerCount > POWEROFF_TIMEOUT) @@ -50,10 +49,9 @@ void WirelessHIDDevice::ChatPadTimerActionWrapper(OSObject *owner, IOTimerEventS // Sets the LED with the same format as the wired controller void WirelessHIDDevice::SetLEDs(int mode) { - char buf[] = {0x00, 0x00, 0x08, 0x40 + (mode % 0x0e), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - WirelessDevice *device; + unsigned char buf[] = {0x00, 0x00, 0x08, (unsigned char)(0x40 + (mode % 0x0e)), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + WirelessDevice *device = OSDynamicCast(WirelessDevice, getProvider()); - device = OSDynamicCast(WirelessDevice, getProvider()); if (device != NULL) { device->SendPacket(buf, sizeof(buf)); @@ -69,14 +67,13 @@ unsigned char WirelessHIDDevice::GetBatteryLevel(void) void WirelessHIDDevice::PowerOff(void) { - char buf[] = {0x00, 0x00, 0x08, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - WirelessDevice *device; + static const unsigned char buf[] = {0x00, 0x00, 0x08, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + WirelessDevice *device = OSDynamicCast(WirelessDevice, getProvider()); - device = OSDynamicCast(WirelessDevice, getProvider()); if (device != NULL) { device->SendPacket(buf, sizeof(buf)); -// device->SendPacket(weirdStart, sizeof(weirdStart)); + // device->SendPacket(weirdStart, sizeof(weirdStart)); } } @@ -146,9 +143,8 @@ bool WirelessHIDDevice::handleStart(IOService *provider) // Shut down the driver void WirelessHIDDevice::handleStop(IOService *provider) { - WirelessDevice *device; + WirelessDevice *device = OSDynamicCast(WirelessDevice, provider); - device = OSDynamicCast(WirelessDevice, provider); if (device != NULL) device->RegisterWatcher(NULL, NULL, NULL); @@ -252,7 +248,7 @@ void WirelessHIDDevice::receivedHIDupdate(unsigned char *data, int length) serialTimerCount = 0; report = IOMemoryDescriptor::withAddress(data, length, kIODirectionNone); - err = handleReport(report, kIOHIDReportTypeInput); + err = handleReport(report); report->release(); if (err != kIOReturnSuccess) IOLog("handleReport return: 0x%.8x\n", err); diff --git a/WirelessGamingReceiver/version.plist b/WirelessGamingReceiver/version.plist deleted file mode 100644 index 53bf3a3..0000000 --- a/WirelessGamingReceiver/version.plist +++ /dev/null @@ -1,16 +0,0 @@ - - - - - BuildVersion - 12 - CFBundleVersion - 1.0 - ProductBuildVersion - 7K571 - ProjectName - DevToolsWizardTemplates - SourceVersion - 3870000 - - diff --git a/build b/build deleted file mode 100755 index 65324c5..0000000 --- a/build +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -zip -r ../360ControllerSource.zip * -cd Feedback360 -xcodebuild -configuration Deployment -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../DriverTool -xcodebuild -configuration Release -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../360Controller -xcodebuild -configuration Deployment -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../360Daemon -xcodebuild -configuration Release -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../WirelessGamingReceiver -xcodebuild -configuration Release -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../Wireless360Controller -xcodebuild -configuration Release -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../Pref360Control -xcodebuild -configuration Deployment -if [ $? -ne 0 ] - then - echo "******** BUILD FAILED ********" - exit 1 -fi -cd ../Install360Controller -packagesbuild -v Install360Controller.pkgproj -mv build 360ControllerInstall -hdiutil create -srcfolder 360ControllerInstall -format UDZO ../../360ControllerInstall.dmg -mv 360ControllerInstall build -cd .. -echo "** File contents **" -lipo -info 360Controller/build/Deployment/360Controller.kext/Contents/MacOS/360Controller -lipo -info 360Controller/build/Deployment/360Controller.kext/Contents/PlugIns/Feedback360.plugin/Contents/MacOS/Feedback360 -lipo -info 360Daemon/build/Release/360Daemon -lipo -info Pref360Control/build/Deployment/Pref360Control.prefPane/Contents/MacOS/Pref360Control -lipo -info Pref360Control/build/Deployment/Pref360Control.prefPane/Contents/Resources/DriverTool -lipo -info WirelessGamingReceiver/build/Release/WirelessGamingReceiver.kext/Contents/MacOS/WirelessGamingReceiver -lipo -info Wireless360Controller/build/Release/Wireless360Controller.kext/Contents/MacOS/Wireless360Controller -echo "** File signatures **" -sudo spctl -a -v 360Controller/build/Deployment/360Controller.kext -sudo spctl -a -v 360Controller/build/Deployment/360Controller.kext/Contents/PlugIns/Feedback360.plugin -sudo spctl -a -v 360Daemon/build/Release/360Daemon -sudo spctl -a -v Pref360Control/build/Deployment/Pref360Control.prefPane -sudo spctl -a -v Pref360Control/build/Deployment/Pref360Control.prefPane/Contents/Resources/DriverTool -sudo spctl -a -v WirelessGamingReceiver/build/Release/WirelessGamingReceiver.kext -sudo spctl -a -v Wireless360Controller/build/Release/Wireless360Controller.kext -sudo spctl -a -v --type install Install360Controller/build/Install360Controller.pkg -echo "*** DONE ***" diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..fa1bda8 --- /dev/null +++ b/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash +mkdir -p build +zip -r build/360ControllerSource.zip * -x "build*" + +xcrun xcodebuild -configuration Release -target "Whole Driver" +if [ $? -ne 0 ] + then + echo "******** BUILD FAILED ********" + exit 1 +fi + +cd Install360Controller +packagesbuild -v Install360Controller.pkgproj +mv build 360ControllerInstall +hdiutil create -srcfolder 360ControllerInstall -format UDZO ../build/360ControllerInstall.dmg +mv 360ControllerInstall build +cd .. +echo "** File contents **" +xcrun lipo -info build/Release/360Controller.kext/Contents/MacOS/360Controller +xcrun lipo -info build/Release/360Controller.kext/Contents/PlugIns/Feedback360.plugin/Contents/MacOS/Feedback360 +xcrun lipo -info build/Release/360Daemon.app/Contents/MacOS/360Daemon +xcrun lipo -info build/Release/Pref360Control.prefPane/Contents/MacOS/Pref360Control +xcrun lipo -info build/Release/Pref360Control.prefPane/Contents/Resources/DriverTool +xcrun lipo -info build/Release/WirelessGamingReceiver.kext/Contents/MacOS/WirelessGamingReceiver +xcrun lipo -info build/Release/Wireless360Controller.kext/Contents/MacOS/Wireless360Controller +echo "** File signatures **" +xcrun spctl -a -v build/Release/360Controller.kext +xcrun spctl -a -v build/Release/360Controller.kext/Contents/PlugIns/Feedback360.plugin +xcrun spctl -a -v build/Release/360Daemon.app/Contents/MacOS/360Daemon +xcrun spctl -a -v build/Release/Pref360Control.prefPane +xcrun spctl -a -v build/Release/Pref360Control.prefPane/Contents/Resources/DriverTool +xcrun spctl -a -v build/Release/WirelessGamingReceiver.kext +xcrun spctl -a -v build/Release/Wireless360Controller.kext +xcrun spctl -a -v --type install Install360Controller/build/Install360Controller.pkg +echo "*** DONE ***" diff --git a/clean.sh b/clean.sh new file mode 100755 index 0000000..81149e9 --- /dev/null +++ b/clean.sh @@ -0,0 +1,6 @@ +#!/bin/bash +for i in Install360Controller; do + rm -rf $i/build +done +rm -rf build +echo "Deleted build products."