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
90d86081
Commit
90d86081
authored
Jun 16, 2011
by
Jonas Maebe
Committed by
Alexandre Julliard
Jun 17, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Hook up joysticks to DirectInput event queue on Mac OS X.
parent
37d70103
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
11 deletions
+50
-11
joystick_osx.c
dlls/dinput/joystick_osx.c
+50
-11
No files found.
dlls/dinput/joystick_osx.c
View file @
90d86081
...
@@ -516,12 +516,13 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -516,12 +516,13 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
int
button_idx
=
0
;
int
button_idx
=
0
;
int
pov_idx
=
0
;
int
pov_idx
=
0
;
int
slider_idx
=
0
;
int
slider_idx
=
0
;
int
inst_id
;
CFIndex
idx
,
cnt
=
CFArrayGetCount
(
gElementCFArrayRef
);
CFIndex
idx
,
cnt
=
CFArrayGetCount
(
gElementCFArrayRef
);
for
(
idx
=
0
;
idx
<
cnt
;
idx
++
)
for
(
idx
=
0
;
idx
<
cnt
;
idx
++
)
{
{
IOHIDValueRef
valueRef
;
IOHIDValueRef
valueRef
;
int
val
;
int
val
,
oldVal
,
newVal
;
IOHIDElementRef
tIOHIDElementRef
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
gElementCFArrayRef
,
idx
);
IOHIDElementRef
tIOHIDElementRef
=
(
IOHIDElementRef
)
CFArrayGetValueAtIndex
(
gElementCFArrayRef
,
idx
);
int
eleType
=
IOHIDElementGetType
(
tIOHIDElementRef
);
int
eleType
=
IOHIDElementGetType
(
tIOHIDElementRef
);
...
@@ -532,7 +533,14 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -532,7 +533,14 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
{
{
IOHIDDeviceGetValue
(
tIOHIDDeviceRef
,
tIOHIDElementRef
,
&
valueRef
);
IOHIDDeviceGetValue
(
tIOHIDDeviceRef
,
tIOHIDElementRef
,
&
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
device
->
generic
.
js
.
rgbButtons
[
button_idx
]
=
val
?
0x80
:
0x00
;
newVal
=
val
?
0x80
:
0x0
;
oldVal
=
device
->
generic
.
js
.
rgbButtons
[
button_idx
];
device
->
generic
.
js
.
rgbButtons
[
button_idx
]
=
newVal
;
if
(
oldVal
!=
newVal
)
{
inst_id
=
DIDFT_MAKEINSTANCE
(
button_idx
)
|
DIDFT_PSHBUTTON
;
queue_event
(
iface
,
inst_id
,
newVal
,
GetCurrentTime
(),
device
->
generic
.
base
.
dinput
->
evsequence
++
);
}
button_idx
++
;
button_idx
++
;
}
}
break
;
break
;
...
@@ -545,10 +553,17 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -545,10 +553,17 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
{
{
IOHIDDeviceGetValue
(
tIOHIDDeviceRef
,
tIOHIDElementRef
,
&
valueRef
);
IOHIDDeviceGetValue
(
tIOHIDDeviceRef
,
tIOHIDElementRef
,
&
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
oldVal
=
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
];
if
(
val
>=
8
)
if
(
val
>=
8
)
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
]
=
-
1
;
newVal
=
-
1
;
else
else
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
]
=
val
*
4500
;
newVal
=
val
*
4500
;
device
->
generic
.
js
.
rgdwPOV
[
pov_idx
]
=
newVal
;
if
(
oldVal
!=
newVal
)
{
inst_id
=
DIDFT_MAKEINSTANCE
(
pov_idx
)
|
DIDFT_POV
;
queue_event
(
iface
,
inst_id
,
newVal
,
GetCurrentTime
(),
device
->
generic
.
base
.
dinput
->
evsequence
++
);
}
pov_idx
++
;
pov_idx
++
;
break
;
break
;
}
}
...
@@ -560,33 +575,57 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
...
@@ -560,33 +575,57 @@ static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
case
kHIDUsage_GD_Rz
:
case
kHIDUsage_GD_Rz
:
case
kHIDUsage_GD_Slider
:
case
kHIDUsage_GD_Slider
:
{
{
int
wine_obj
=
-
1
;
IOHIDDeviceGetValue
(
tIOHIDDeviceRef
,
tIOHIDElementRef
,
&
valueRef
);
IOHIDDeviceGetValue
(
tIOHIDDeviceRef
,
tIOHIDElementRef
,
&
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
val
=
IOHIDValueGetIntegerValue
(
valueRef
);
newVal
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
switch
(
usage
)
switch
(
usage
)
{
{
case
kHIDUsage_GD_X
:
case
kHIDUsage_GD_X
:
device
->
generic
.
js
.
lX
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
0
;
oldVal
=
device
->
generic
.
js
.
lX
;
device
->
generic
.
js
.
lX
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Y
:
case
kHIDUsage_GD_Y
:
device
->
generic
.
js
.
lY
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
1
;
oldVal
=
device
->
generic
.
js
.
lY
;
device
->
generic
.
js
.
lY
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Z
:
case
kHIDUsage_GD_Z
:
device
->
generic
.
js
.
lZ
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
2
;
oldVal
=
device
->
generic
.
js
.
lZ
;
device
->
generic
.
js
.
lZ
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Rx
:
case
kHIDUsage_GD_Rx
:
device
->
generic
.
js
.
lRx
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
3
;
oldVal
=
device
->
generic
.
js
.
lRx
;
device
->
generic
.
js
.
lRx
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Ry
:
case
kHIDUsage_GD_Ry
:
device
->
generic
.
js
.
lRy
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
4
;
oldVal
=
device
->
generic
.
js
.
lRy
;
device
->
generic
.
js
.
lRy
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Rz
:
case
kHIDUsage_GD_Rz
:
device
->
generic
.
js
.
lRz
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
5
;
oldVal
=
device
->
generic
.
js
.
lRz
;
device
->
generic
.
js
.
lRz
=
newVal
;
break
;
break
;
case
kHIDUsage_GD_Slider
:
case
kHIDUsage_GD_Slider
:
device
->
generic
.
js
.
rglSlider
[
slider_idx
]
=
joystick_map_axis
(
&
device
->
generic
.
props
[
idx
],
val
);
wine_obj
=
6
+
slider_idx
;
oldVal
=
device
->
generic
.
js
.
rglSlider
[
slider_idx
];
device
->
generic
.
js
.
rglSlider
[
slider_idx
]
=
newVal
;
slider_idx
++
;
slider_idx
++
;
break
;
break
;
}
}
if
((
wine_obj
!=
-
1
)
&&
(
oldVal
!=
newVal
))
{
inst_id
=
DIDFT_MAKEINSTANCE
(
wine_obj
)
|
DIDFT_ABSAXIS
;
queue_event
(
iface
,
inst_id
,
newVal
,
GetCurrentTime
(),
device
->
generic
.
base
.
dinput
->
evsequence
++
);
}
break
;
break
;
}
}
default:
default:
...
...
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