@@ -31,7 +31,9 @@ let buttonNames: [JoyCon.Button: String] = [
3131 . LeftSL: " Left SL " ,
3232 . LeftSR: " Left SR " ,
3333 . RightSL: " Right SL " ,
34- . RightSR: " Right SR "
34+ . RightSR: " Right SR " ,
35+ . Start: " Start " ,
36+ . Select: " Select " ,
3537]
3638let directionNames : [ JoyCon . StickDirection : String ] = [
3739 . Up: " Up " ,
@@ -45,7 +47,18 @@ let rightStickName = NSLocalizedString("Right Stick", comment: "Right Stick")
4547let controllerButtons : [ JoyCon . ControllerType : [ JoyCon . Button ] ] = [
4648 . JoyConL: [ . Up, . Right, . Down, . Left, . LeftSL, . LeftSR, . L, . ZL, . Minus, . Capture, . LStick] ,
4749 . JoyConR: [ . A, . B, . X, . Y, . RightSL, . RightSR, . R, . ZR, . Plus, . Home, . RStick] ,
48- . ProController: [ . A, . B, . X, . Y, . L, . ZL, . R, . ZR, . Up, . Right, . Down, . Left, . Minus, . Plus, . Capture, . Home, . LStick, . RStick]
50+ . ProController: [ . A, . B, . X, . Y, . L, . ZL, . R, . ZR, . Up, . Right, . Down, . Left, . Minus, . Plus, . Capture, . Home, . LStick, . RStick] ,
51+ . FamicomController1: [ . A, . B, . L, . R, . Up, . Right, . Down, . Left, . Start, . Select] ,
52+ . FamicomController2: [ . A, . B, . L, . R, . Up, . Right, . Down, . Left] ,
53+ . SNESController: [ . A, . B, . X, . Y, . L, . ZL, . R, . ZR, . Up, . Right, . Down, . Left, . Start, . Select] ,
54+ ]
55+ let numSticks : [ JoyCon . ControllerType : Int ] = [
56+ . JoyConL: 1 ,
57+ . JoyConR: 1 ,
58+ . ProController: 2 ,
59+ . FamicomController1: 0 ,
60+ . FamicomController2: 0 ,
61+ . SNESController: 0
4962]
5063let stickerDirections : [ JoyCon . StickDirection ] = [
5164 . Up, . Right, . Down, . Left
@@ -87,6 +100,10 @@ extension ViewController: NSOutlineViewDelegate, NSOutlineViewDataSource, KeyCon
87100 guard let buttons = controllerButtons [ controller. type] else { return 0 }
88101 guard let config = self . selectedKeyConfig else { return 0 }
89102
103+ if controller. type == . unknown {
104+ return 0
105+ }
106+
90107 if let indexOfItem = item as? Int {
91108 let stickIndex = indexOfItem - buttons. count
92109
@@ -111,13 +128,7 @@ extension ViewController: NSOutlineViewDelegate, NSOutlineViewDataSource, KeyCon
111128 return 0
112129 }
113130
114- if controller. type == . JoyConL || controller. type == . JoyConR {
115- return buttons. count + 1
116- }
117- if controller. type == . ProController {
118- return buttons. count + 2
119- }
120- return 0
131+ return buttons. count + ( numSticks [ controller. type] ?? 0 )
121132 }
122133
123134 func numberOfChildItemOfStick( for type: String ? ) -> Int {
0 commit comments