move IOHIDManagerSetDeviceMatching call after IOHIDManagerOpen. this prevents IOHIDManagerOpen from failing if it would match an exclusive-opened device
parent
5a1452b72c
commit
ae5f5553e6
|
@ -12,10 +12,11 @@ SYMBOLS: +hid-manager+ +keyboard-state+ +mouse-state+ +controller-states+ ;
|
|||
|
||||
iokit-game-input-backend game-input-backend set-global
|
||||
|
||||
: hid-manager-matching ( matching-seq -- alien )
|
||||
f 0 IOHIDManagerCreate
|
||||
[ swap >plist IOHIDManagerSetDeviceMatchingMultiple ]
|
||||
keep ;
|
||||
: make-hid-manager ( -- alien )
|
||||
f 0 IOHIDManagerCreate ;
|
||||
|
||||
: set-hid-manager-matching ( alien matching-seq -- )
|
||||
>plist IOHIDManagerSetDeviceMatchingMultiple ;
|
||||
|
||||
: devices-from-hid-manager ( manager -- vector )
|
||||
[
|
||||
|
@ -85,9 +86,6 @@ CONSTANT: hat-switch-matching-hash
|
|||
: ?hat-switch ( device -- ? )
|
||||
hat-switch-matching-hash ?axis ;
|
||||
|
||||
: hid-manager-matching-game-devices ( -- alien )
|
||||
game-devices-matching-seq hid-manager-matching ;
|
||||
|
||||
: device-property ( device key -- value )
|
||||
<NSString> IOHIDDeviceGetProperty [ plist> ] [ f ] if* ;
|
||||
: element-property ( element key -- value )
|
||||
|
@ -288,12 +286,13 @@ M: iokit-game-input-backend reset-mouse
|
|||
256 <bit-array> +keyboard-state+ set-global ;
|
||||
|
||||
M: iokit-game-input-backend (open-game-input)
|
||||
hid-manager-matching-game-devices {
|
||||
make-hid-manager {
|
||||
[ initialize-variables ]
|
||||
[ device-matched-callback f IOHIDManagerRegisterDeviceMatchingCallback ]
|
||||
[ device-removed-callback f IOHIDManagerRegisterDeviceRemovalCallback ]
|
||||
[ device-input-callback f IOHIDManagerRegisterInputValueCallback ]
|
||||
[ 0 IOHIDManagerOpen mach-error ]
|
||||
[ game-devices-matching-seq set-hid-manager-matching ]
|
||||
[
|
||||
CFRunLoopGetMain CFRunLoopDefaultMode
|
||||
IOHIDManagerScheduleWithRunLoop
|
||||
|
|
Loading…
Reference in New Issue