Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
7367c68c
Commit
7367c68c
authored
Apr 13, 2014
by
Ken Thomases
Committed by
Alexandre Julliard
Apr 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Add additional debug logging to Mac code.
parent
180b9e63
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
5 deletions
+105
-5
joystick_osx.c
dlls/dinput/joystick_osx.c
+105
-5
No files found.
dlls/dinput/joystick_osx.c
View file @
7367c68c
...
@@ -180,11 +180,56 @@ static void CFSetApplierFunctionCopyToCFArray(const void *value, void *context)
...
@@ -180,11 +180,56 @@ static void CFSetApplierFunctionCopyToCFArray(const void *value, void *context)
CFArrayAppendValue
(
(
CFMutableArrayRef
)
context
,
value
);
CFArrayAppendValue
(
(
CFMutableArrayRef
)
context
,
value
);
}
}
static
const
char
*
debugstr_cf
(
CFTypeRef
t
)
{
CFStringRef
s
;
const
char
*
ret
;
if
(
!
t
)
return
"(null)"
;
if
(
CFGetTypeID
(
t
)
==
CFStringGetTypeID
())
s
=
t
;
else
s
=
CFCopyDescription
(
t
);
ret
=
CFStringGetCStringPtr
(
s
,
kCFStringEncodingUTF8
);
if
(
ret
)
ret
=
debugstr_a
(
ret
);
if
(
!
ret
)
{
const
UniChar
*
u
=
CFStringGetCharactersPtr
(
s
);
if
(
u
)
ret
=
debugstr_wn
((
const
WCHAR
*
)
u
,
CFStringGetLength
(
s
));
}
if
(
!
ret
)
{
UniChar
buf
[
200
];
int
len
=
min
(
CFStringGetLength
(
s
),
sizeof
(
buf
)
/
sizeof
(
buf
[
0
]));
CFStringGetCharacters
(
s
,
CFRangeMake
(
0
,
len
),
buf
);
ret
=
debugstr_wn
(
buf
,
len
);
}
if
(
s
!=
t
)
CFRelease
(
s
);
return
ret
;
}
static
const
char
*
debugstr_device
(
IOHIDDeviceRef
device
)
{
return
wine_dbg_sprintf
(
"<IOHIDDevice %p product %s>"
,
device
,
debugstr_cf
(
IOHIDDeviceGetProperty
(
device
,
CFSTR
(
kIOHIDProductKey
))));
}
static
const
char
*
debugstr_element
(
IOHIDElementRef
element
)
{
return
wine_dbg_sprintf
(
"<IOHIDElement %p type %d usage %u/%u device %p>"
,
element
,
IOHIDElementGetType
(
element
),
IOHIDElementGetUsagePage
(
element
),
IOHIDElementGetUsage
(
element
),
IOHIDElementGetDevice
(
element
));
}
static
IOHIDDeviceRef
get_device_ref
(
int
id
)
static
IOHIDDeviceRef
get_device_ref
(
int
id
)
{
{
IOHIDElementRef
device_main_element
;
IOHIDElementRef
device_main_element
;
IOHIDDeviceRef
hid_device
;
IOHIDDeviceRef
hid_device
;
TRACE
(
"id %d
\n
"
,
id
);
if
(
!
device_main_elements
||
id
>=
CFArrayGetCount
(
device_main_elements
))
if
(
!
device_main_elements
||
id
>=
CFArrayGetCount
(
device_main_elements
))
return
0
;
return
0
;
...
@@ -202,6 +247,7 @@ static IOHIDDeviceRef get_device_ref(int id)
...
@@ -202,6 +247,7 @@ static IOHIDDeviceRef get_device_ref(int id)
return
0
;
return
0
;
}
}
TRACE
(
"-> %s
\n
"
,
debugstr_device
(
hid_device
));
return
hid_device
;
return
hid_device
;
}
}
...
@@ -212,6 +258,8 @@ static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret)
...
@@ -212,6 +258,8 @@ static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret)
CFTypeRef
location_id
;
CFTypeRef
location_id
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"device %s
\n
"
,
debugstr_device
(
device
));
matching
=
IOServiceMatching
(
kIOHIDDeviceKey
);
matching
=
IOServiceMatching
(
kIOHIDDeviceKey
);
if
(
!
matching
){
if
(
!
matching
){
WARN
(
"IOServiceMatching failed, force feedback disabled
\n
"
);
WARN
(
"IOServiceMatching failed, force feedback disabled
\n
"
);
...
@@ -235,6 +283,7 @@ static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret)
...
@@ -235,6 +283,7 @@ static HRESULT get_ff(IOHIDDeviceRef device, FFDeviceObjectReference *ret)
hr
=
FFIsForceFeedback
(
service
)
==
FF_OK
?
S_OK
:
S_FALSE
;
hr
=
FFIsForceFeedback
(
service
)
==
FF_OK
?
S_OK
:
S_FALSE
;
IOObjectRelease
(
service
);
IOObjectRelease
(
service
);
TRACE
(
"-> hr 0x%08x *ret %p
\n
"
,
hr
,
ret
?
*
ret
:
NULL
);
return
hr
;
return
hr
;
}
}
...
@@ -242,6 +291,8 @@ static CFMutableDictionaryRef create_osx_device_match(int usage)
...
@@ -242,6 +291,8 @@ static CFMutableDictionaryRef create_osx_device_match(int usage)
{
{
CFMutableDictionaryRef
result
;
CFMutableDictionaryRef
result
;
TRACE
(
"usage %d
\n
"
,
usage
);
result
=
CFDictionaryCreateMutable
(
kCFAllocatorDefault
,
0
,
result
=
CFDictionaryCreateMutable
(
kCFAllocatorDefault
,
0
,
&
kCFTypeDictionaryKeyCallBacks
,
&
kCFTypeDictionaryValueCallBacks
);
&
kCFTypeDictionaryKeyCallBacks
,
&
kCFTypeDictionaryValueCallBacks
);
...
@@ -293,6 +344,8 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_
...
@@ -293,6 +344,8 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_
CFArrayRef
elements
;
CFArrayRef
elements
;
CFIndex
total
=
0
;
CFIndex
total
=
0
;
TRACE
(
"hid_device %s
\n
"
,
debugstr_device
(
hid_device
));
if
(
!
hid_device
)
if
(
!
hid_device
)
return
0
;
return
0
;
...
@@ -306,6 +359,8 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_
...
@@ -306,6 +359,8 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
elements
,
idx
);
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
elements
,
idx
);
int
type
=
IOHIDElementGetType
(
element
);
int
type
=
IOHIDElementGetType
(
element
);
TRACE
(
"element %s
\n
"
,
debugstr_element
(
element
));
/* Check for top-level gaming device collections */
/* Check for top-level gaming device collections */
if
(
type
==
kIOHIDElementTypeCollection
&&
IOHIDElementGetParent
(
element
)
==
0
)
if
(
type
==
kIOHIDElementTypeCollection
&&
IOHIDElementGetParent
(
element
)
==
0
)
{
{
...
@@ -322,6 +377,8 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_
...
@@ -322,6 +377,8 @@ static CFIndex find_top_level(IOHIDDeviceRef hid_device, CFMutableArrayRef main_
}
}
CFRelease
(
elements
);
CFRelease
(
elements
);
}
}
TRACE
(
"-> total %d
\n
"
,
(
int
)
total
);
return
total
;
return
total
;
}
}
...
@@ -330,6 +387,8 @@ static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_
...
@@ -330,6 +387,8 @@ static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_
CFIndex
idx
,
cnt
;
CFIndex
idx
,
cnt
;
CFArrayRef
element_children
=
IOHIDElementGetChildren
(
element
);
CFArrayRef
element_children
=
IOHIDElementGetChildren
(
element
);
TRACE
(
"element %s
\n
"
,
debugstr_element
(
element
));
cnt
=
CFArrayGetCount
(
element_children
);
cnt
=
CFArrayGetCount
(
element_children
);
/* Either add the element to the array or grab its children */
/* Either add the element to the array or grab its children */
...
@@ -338,6 +397,7 @@ static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_
...
@@ -338,6 +397,7 @@ static void get_element_children(IOHIDElementRef element, CFMutableArrayRef all_
IOHIDElementRef
child
;
IOHIDElementRef
child
;
child
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
element_children
,
idx
);
child
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
element_children
,
idx
);
TRACE
(
"child %s
\n
"
,
debugstr_element
(
child
));
if
(
IOHIDElementGetType
(
child
)
==
kIOHIDElementTypeCollection
)
if
(
IOHIDElementGetType
(
child
)
==
kIOHIDElementTypeCollection
)
get_element_children
(
child
,
all_children
);
get_element_children
(
child
,
all_children
);
else
else
...
@@ -352,6 +412,8 @@ static int find_osx_devices(void)
...
@@ -352,6 +412,8 @@ static int find_osx_devices(void)
CFSetRef
devset
;
CFSetRef
devset
;
CFMutableArrayRef
matching
;
CFMutableArrayRef
matching
;
TRACE
(
"()
\n
"
);
hid_manager
=
IOHIDManagerCreate
(
kCFAllocatorDefault
,
0L
);
hid_manager
=
IOHIDManagerCreate
(
kCFAllocatorDefault
,
0L
);
if
(
IOHIDManagerOpen
(
hid_manager
,
0
)
!=
kIOReturnSuccess
)
if
(
IOHIDManagerOpen
(
hid_manager
,
0
)
!=
kIOReturnSuccess
)
{
{
...
@@ -406,6 +468,7 @@ static int find_osx_devices(void)
...
@@ -406,6 +468,7 @@ static int find_osx_devices(void)
IOHIDDeviceRef
hid_device
;
IOHIDDeviceRef
hid_device
;
hid_device
=
(
IOHIDDeviceRef
)
CFArrayGetValueAtIndex
(
devices
,
idx
);
hid_device
=
(
IOHIDDeviceRef
)
CFArrayGetValueAtIndex
(
devices
,
idx
);
TRACE
(
"hid_device %s
\n
"
,
debugstr_device
(
hid_device
));
top
=
find_top_level
(
hid_device
,
device_main_elements
);
top
=
find_top_level
(
hid_device
,
device_main_elements
);
num_main_elements
+=
top
;
num_main_elements
+=
top
;
}
}
...
@@ -429,6 +492,8 @@ static int get_osx_device_name(int id, char *name, int length)
...
@@ -429,6 +492,8 @@ static int get_osx_device_name(int id, char *name, int length)
hid_device
=
get_device_ref
(
id
);
hid_device
=
get_device_ref
(
id
);
TRACE
(
"id %d hid_device %s
\n
"
,
id
,
debugstr_device
(
hid_device
));
if
(
name
)
if
(
name
)
name
[
0
]
=
0
;
name
[
0
]
=
0
;
...
@@ -468,13 +533,15 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -468,13 +533,15 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
CFMutableArrayRef
elements
;
CFMutableArrayRef
elements
;
DWORD
sliders
=
0
;
DWORD
sliders
=
0
;
TRACE
(
"device %p device->id %d
\n
"
,
device
,
device
->
id
);
device
->
elements
=
NULL
;
device
->
elements
=
NULL
;
if
(
!
device_main_elements
||
device
->
id
>=
CFArrayGetCount
(
device_main_elements
))
if
(
!
device_main_elements
||
device
->
id
>=
CFArrayGetCount
(
device_main_elements
))
return
;
return
;
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
TRACE
(
"device_main_element %s
\n
"
,
debugstr_element
(
device_main_element
));
if
(
!
device_main_element
)
if
(
!
device_main_element
)
return
;
return
;
...
@@ -492,11 +559,15 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -492,11 +559,15 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
{
{
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
elements
,
idx
);
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
elements
,
idx
);
int
type
=
IOHIDElementGetType
(
element
);
int
type
=
IOHIDElementGetType
(
element
);
TRACE
(
"element %s
\n
"
,
debugstr_element
(
element
));
switch
(
type
)
switch
(
type
)
{
{
case
kIOHIDElementTypeInput_Button
:
case
kIOHIDElementTypeInput_Button
:
{
{
int
usage_page
=
IOHIDElementGetUsagePage
(
element
);
int
usage_page
=
IOHIDElementGetUsagePage
(
element
);
TRACE
(
"kIOHIDElementTypeInput_Button usage_page %d
\n
"
,
usage_page
);
if
(
usage_page
!=
kHIDPage_Button
)
if
(
usage_page
!=
kHIDPage_Button
)
{
{
/* avoid strange elements found on the 360 controller */
/* avoid strange elements found on the 360 controller */
...
@@ -509,6 +580,7 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -509,6 +580,7 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
}
}
case
kIOHIDElementTypeInput_Axis
:
case
kIOHIDElementTypeInput_Axis
:
{
{
TRACE
(
"kIOHIDElementTypeInput_Axis
\n
"
);
CFArrayAppendValue
(
axes
,
element
);
CFArrayAppendValue
(
axes
,
element
);
break
;
break
;
}
}
...
@@ -519,6 +591,7 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -519,6 +591,7 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
{
{
case
kHIDUsage_GD_Hatswitch
:
case
kHIDUsage_GD_Hatswitch
:
{
{
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Hatswitch
\n
"
);
CFArrayAppendValue
(
povs
,
element
);
CFArrayAppendValue
(
povs
,
element
);
break
;
break
;
}
}
...
@@ -534,12 +607,13 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -534,12 +607,13 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
case
kHIDUsage_GD_Ry
:
case
kHIDUsage_GD_Ry
:
case
kHIDUsage_GD_Rz
:
case
kHIDUsage_GD_Rz
:
{
{
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_* (%d)
\n
"
,
usage
);
axis_map
[
CFArrayGetCount
(
axes
)]
=
usage
;
axis_map
[
CFArrayGetCount
(
axes
)]
=
usage
;
CFArrayAppendValue
(
axes
,
element
);
CFArrayAppendValue
(
axes
,
element
);
break
;
break
;
}
}
default:
default:
FIXME
(
"
Unhandled usage %i
\n
"
,
usage
);
FIXME
(
"
kIOHIDElementTypeInput_Misc / Unhandled usage %i
\n
"
,
usage
);
}
}
break
;
break
;
}
}
...
@@ -555,6 +629,9 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -555,6 +629,9 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
device
->
generic
.
devcaps
.
dwButtons
=
CFArrayGetCount
(
buttons
);
device
->
generic
.
devcaps
.
dwButtons
=
CFArrayGetCount
(
buttons
);
device
->
generic
.
devcaps
.
dwPOVs
=
CFArrayGetCount
(
povs
);
device
->
generic
.
devcaps
.
dwPOVs
=
CFArrayGetCount
(
povs
);
TRACE
(
"axes %u povs %u buttons %u
\n
"
,
device
->
generic
.
devcaps
.
dwAxes
,
device
->
generic
.
devcaps
.
dwPOVs
,
device
->
generic
.
devcaps
.
dwButtons
);
/* build our element array in the order that dinput expects */
/* build our element array in the order that dinput expects */
CFArrayAppendArray
(
axes
,
povs
,
CFRangeMake
(
0
,
device
->
generic
.
devcaps
.
dwPOVs
));
CFArrayAppendArray
(
axes
,
povs
,
CFRangeMake
(
0
,
device
->
generic
.
devcaps
.
dwPOVs
));
CFArrayAppendArray
(
axes
,
buttons
,
CFRangeMake
(
0
,
device
->
generic
.
devcaps
.
dwButtons
));
CFArrayAppendArray
(
axes
,
buttons
,
CFRangeMake
(
0
,
device
->
generic
.
devcaps
.
dwButtons
));
...
@@ -575,6 +652,8 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
...
@@ -575,6 +652,8 @@ static void get_osx_device_elements(JoystickImpl *device, int axis_map[8])
static
void
get_osx_device_elements_props
(
JoystickImpl
*
device
)
static
void
get_osx_device_elements_props
(
JoystickImpl
*
device
)
{
{
TRACE
(
"device %p
\n
"
,
device
);
if
(
device
->
elements
)
if
(
device
->
elements
)
{
{
CFIndex
idx
,
cnt
=
CFArrayGetCount
(
device
->
elements
);
CFIndex
idx
,
cnt
=
CFArrayGetCount
(
device
->
elements
);
...
@@ -583,6 +662,8 @@ static void get_osx_device_elements_props(JoystickImpl *device)
...
@@ -583,6 +662,8 @@ static void get_osx_device_elements_props(JoystickImpl *device)
{
{
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device
->
elements
,
idx
);
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device
->
elements
,
idx
);
TRACE
(
"element %s
\n
"
,
debugstr_element
(
element
));
device
->
generic
.
props
[
idx
].
lDevMin
=
IOHIDElementGetLogicalMin
(
element
);
device
->
generic
.
props
[
idx
].
lDevMin
=
IOHIDElementGetLogicalMin
(
element
);
device
->
generic
.
props
[
idx
].
lDevMax
=
IOHIDElementGetLogicalMax
(
element
);
device
->
generic
.
props
[
idx
].
lDevMax
=
IOHIDElementGetLogicalMax
(
element
);
device
->
generic
.
props
[
idx
].
lMin
=
0
;
device
->
generic
.
props
[
idx
].
lMin
=
0
;
...
@@ -599,14 +680,14 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -599,14 +680,14 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
IOHIDElementRef
device_main_element
;
IOHIDElementRef
device_main_element
;
IOHIDDeviceRef
hid_device
;
IOHIDDeviceRef
hid_device
;
TRACE
(
"
polling device %i
\n
"
,
device
->
id
);
TRACE
(
"
device %p device->id %i
\n
"
,
device
,
device
->
id
);
if
(
!
device_main_elements
||
device
->
id
>=
CFArrayGetCount
(
device_main_elements
))
if
(
!
device_main_elements
||
device
->
id
>=
CFArrayGetCount
(
device_main_elements
))
return
;
return
;
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
device_main_element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device_main_elements
,
device
->
id
);
hid_device
=
IOHIDElementGetDevice
(
device_main_element
);
hid_device
=
IOHIDElementGetDevice
(
device_main_element
);
TRACE
(
"main element %s hid_device %s
\n
"
,
debugstr_element
(
device_main_element
),
debugstr_device
(
hid_device
));
if
(
!
hid_device
)
if
(
!
hid_device
)
return
;
return
;
...
@@ -625,9 +706,12 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -625,9 +706,12 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device
->
elements
,
idx
);
IOHIDElementRef
element
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
device
->
elements
,
idx
);
int
type
=
IOHIDElementGetType
(
element
);
int
type
=
IOHIDElementGetType
(
element
);
TRACE
(
"element %s
\n
"
,
debugstr_element
(
element
));
switch
(
type
)
switch
(
type
)
{
{
case
kIOHIDElementTypeInput_Button
:
case
kIOHIDElementTypeInput_Button
:
TRACE
(
"kIOHIDElementTypeInput_Button
\n
"
);
if
(
button_idx
<
128
)
if
(
button_idx
<
128
)
{
{
IOHIDDeviceGetValue
(
hid_device
,
element
,
&
valueRef
);
IOHIDDeviceGetValue
(
hid_device
,
element
,
&
valueRef
);
...
@@ -635,6 +719,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -635,6 +719,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
newVal
=
val
?
0x80
:
0x0
;
newVal
=
val
?
0x80
:
0x0
;
oldVal
=
device
->
generic
.
js
.
rgbButtons
[
button_idx
];
oldVal
=
device
->
generic
.
js
.
rgbButtons
[
button_idx
];
device
->
generic
.
js
.
rgbButtons
[
button_idx
]
=
newVal
;
device
->
generic
.
js
.
rgbButtons
[
button_idx
]
=
newVal
;
TRACE
(
"valueRef %s val %d oldVal %d newVal %d
\n
"
,
debugstr_cf
(
valueRef
),
val
,
oldVal
,
newVal
);
if
(
oldVal
!=
newVal
)
if
(
oldVal
!=
newVal
)
{
{
inst_id
=
DIDFT_MAKEINSTANCE
(
button_idx
)
|
DIDFT_PSHBUTTON
;
inst_id
=
DIDFT_MAKEINSTANCE
(
button_idx
)
|
DIDFT_PSHBUTTON
;
...
@@ -650,6 +735,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -650,6 +735,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
{
{
case
kHIDUsage_GD_Hatswitch
:
case
kHIDUsage_GD_Hatswitch
:
{
{
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Hatswitch
\n
"
);
IOHIDDeviceGetValue
(
hid_device
,
element
,
&
valueRef
);
IOHIDDeviceGetValue
(
hid_device
,
element
,
&
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
oldVal
=
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
];
oldVal
=
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
];
...
@@ -658,6 +744,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -658,6 +744,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
else
else
newVal
=
val
*
4500
;
newVal
=
val
*
4500
;
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
]
=
newVal
;
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
]
=
newVal
;
TRACE
(
"valueRef %s val %d oldVal %d newVal %d
\n
"
,
debugstr_cf
(
valueRef
),
val
,
oldVal
,
newVal
);
if
(
oldVal
!=
newVal
)
if
(
oldVal
!=
newVal
)
{
{
inst_id
=
DIDFT_MAKEINSTANCE
(
pov_idx
)
|
DIDFT_POV
;
inst_id
=
DIDFT_MAKEINSTANCE
(
pov_idx
)
|
DIDFT_POV
;
...
@@ -682,42 +769,50 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -682,42 +769,50 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
switch
(
usage
)
switch
(
usage
)
{
{
case
kHIDUsage_GD_X
:
case
kHIDUsage_GD_X
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_X
\n
"
);
wine_obj
=
0
;
wine_obj
=
0
;
oldVal
=
device
->
generic
.
js
.
lX
;
oldVal
=
device
->
generic
.
js
.
lX
;
device
->
generic
.
js
.
lX
=
newVal
;
device
->
generic
.
js
.
lX
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Y
:
case
kHIDUsage_GD_Y
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Y
\n
"
);
wine_obj
=
1
;
wine_obj
=
1
;
oldVal
=
device
->
generic
.
js
.
lY
;
oldVal
=
device
->
generic
.
js
.
lY
;
device
->
generic
.
js
.
lY
=
newVal
;
device
->
generic
.
js
.
lY
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Z
:
case
kHIDUsage_GD_Z
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Z
\n
"
);
wine_obj
=
2
;
wine_obj
=
2
;
oldVal
=
device
->
generic
.
js
.
lZ
;
oldVal
=
device
->
generic
.
js
.
lZ
;
device
->
generic
.
js
.
lZ
=
newVal
;
device
->
generic
.
js
.
lZ
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Rx
:
case
kHIDUsage_GD_Rx
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Rx
\n
"
);
wine_obj
=
3
;
wine_obj
=
3
;
oldVal
=
device
->
generic
.
js
.
lRx
;
oldVal
=
device
->
generic
.
js
.
lRx
;
device
->
generic
.
js
.
lRx
=
newVal
;
device
->
generic
.
js
.
lRx
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Ry
:
case
kHIDUsage_GD_Ry
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Ry
\n
"
);
wine_obj
=
4
;
wine_obj
=
4
;
oldVal
=
device
->
generic
.
js
.
lRy
;
oldVal
=
device
->
generic
.
js
.
lRy
;
device
->
generic
.
js
.
lRy
=
newVal
;
device
->
generic
.
js
.
lRy
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Rz
:
case
kHIDUsage_GD_Rz
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Rz
\n
"
);
wine_obj
=
5
;
wine_obj
=
5
;
oldVal
=
device
->
generic
.
js
.
lRz
;
oldVal
=
device
->
generic
.
js
.
lRz
;
device
->
generic
.
js
.
lRz
=
newVal
;
device
->
generic
.
js
.
lRz
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Slider
:
case
kHIDUsage_GD_Slider
:
TRACE
(
"kIOHIDElementTypeInput_Misc / kHIDUsage_GD_Slider
\n
"
);
wine_obj
=
6
+
slider_idx
;
wine_obj
=
6
+
slider_idx
;
oldVal
=
device
->
generic
.
js
.
rglSlider
[
slider_idx
];
oldVal
=
device
->
generic
.
js
.
rglSlider
[
slider_idx
];
device
->
generic
.
js
.
rglSlider
[
slider_idx
]
=
newVal
;
device
->
generic
.
js
.
rglSlider
[
slider_idx
]
=
newVal
;
slider_idx
++
;
slider_idx
++
;
break
;
break
;
}
}
TRACE
(
"valueRef %s val %d oldVal %d newVal %d
\n
"
,
debugstr_cf
(
valueRef
),
val
,
oldVal
,
newVal
);
if
((
wine_obj
!=
-
1
)
&&
if
((
wine_obj
!=
-
1
)
&&
(
oldVal
!=
newVal
))
(
oldVal
!=
newVal
))
{
{
...
@@ -728,7 +823,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -728,7 +823,7 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
break
;
break
;
}
}
default:
default:
FIXME
(
"
unhandled usage %i
\n
"
,
usage
);
FIXME
(
"
kIOHIDElementTypeInput_Misc / unhandled usage %i
\n
"
,
usage
);
}
}
break
;
break
;
}
}
...
@@ -752,6 +847,8 @@ static INT find_joystick_devices(void)
...
@@ -752,6 +847,8 @@ static INT find_joystick_devices(void)
static
HRESULT
joydev_enum_deviceA
(
DWORD
dwDevType
,
DWORD
dwFlags
,
LPDIDEVICEINSTANCEA
lpddi
,
DWORD
version
,
int
id
)
static
HRESULT
joydev_enum_deviceA
(
DWORD
dwDevType
,
DWORD
dwFlags
,
LPDIDEVICEINSTANCEA
lpddi
,
DWORD
version
,
int
id
)
{
{
TRACE
(
"dwDevType %u dwFlags 0x%08x version 0x%04x id %d
\n
"
,
dwDevType
,
dwFlags
,
version
,
id
);
if
(
id
>=
find_joystick_devices
())
return
E_FAIL
;
if
(
id
>=
find_joystick_devices
())
return
E_FAIL
;
if
((
dwDevType
==
0
)
||
if
((
dwDevType
==
0
)
||
...
@@ -791,6 +888,8 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
...
@@ -791,6 +888,8 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
char
name
[
MAX_PATH
];
char
name
[
MAX_PATH
];
char
friendly
[
32
];
char
friendly
[
32
];
TRACE
(
"dwDevType %u dwFlags 0x%08x version 0x%04x id %d
\n
"
,
dwDevType
,
dwFlags
,
version
,
id
);
if
(
id
>=
find_joystick_devices
())
return
E_FAIL
;
if
(
id
>=
find_joystick_devices
())
return
E_FAIL
;
if
((
dwDevType
==
0
)
||
if
((
dwDevType
==
0
)
||
...
@@ -1026,6 +1125,7 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
...
@@ -1026,6 +1125,7 @@ static HRESULT alloc_device(REFGUID rguid, IDirectInputImpl *dinput,
newDevice
->
generic
.
devcaps
.
dwFFDriverVersion
=
0
;
newDevice
->
generic
.
devcaps
.
dwFFDriverVersion
=
0
;
if
(
TRACE_ON
(
dinput
))
{
if
(
TRACE_ON
(
dinput
))
{
TRACE
(
"allocated device %p
\n
"
,
newDevice
);
_dump_DIDATAFORMAT
(
newDevice
->
generic
.
base
.
data_format
.
wine_df
);
_dump_DIDATAFORMAT
(
newDevice
->
generic
.
base
.
data_format
.
wine_df
);
_dump_DIDEVCAPS
(
&
newDevice
->
generic
.
devcaps
);
_dump_DIDEVCAPS
(
&
newDevice
->
generic
.
devcaps
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment