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
08388a3c
Commit
08388a3c
authored
Mar 10, 2009
by
Aric Stewart
Committed by
Alexandre Julliard
Mar 11, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Map OS/X joystick axes so even if they come out of order on the device…
dinput: Map OS/X joystick axes so even if they come out of order on the device we recognize them correctly.
parent
17daca76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
joystick_osx.c
dlls/dinput/joystick_osx.c
+19
-4
No files found.
dlls/dinput/joystick_osx.c
View file @
08388a3c
...
@@ -284,7 +284,7 @@ static int get_osx_device_name(int id, char *name, int length)
...
@@ -284,7 +284,7 @@ static int get_osx_device_name(int id, char *name, int length)
return
0
;
return
0
;
}
}
static
void
get_osx_device_elements
(
JoystickImpl
*
device
)
static
void
get_osx_device_elements
(
JoystickImpl
*
device
,
int
axis_map
[
8
]
)
{
{
IOHIDDeviceRef
tIOHIDDeviceRef
;
IOHIDDeviceRef
tIOHIDDeviceRef
;
CFArrayRef
gElementCFArrayRef
;
CFArrayRef
gElementCFArrayRef
;
...
@@ -351,6 +351,7 @@ static void get_osx_device_elements(JoystickImpl *device)
...
@@ -351,6 +351,7 @@ static void get_osx_device_elements(JoystickImpl *device)
case
kHIDUsage_GD_Rz
:
case
kHIDUsage_GD_Rz
:
{
{
CFArrayInsertValueAtIndex
(
device
->
elementCFArrayRef
,
axes
,
tIOHIDElementRef
);
CFArrayInsertValueAtIndex
(
device
->
elementCFArrayRef
,
axes
,
tIOHIDElementRef
);
axis_map
[
axes
]
=
usage
;
axes
++
;
axes
++
;
break
;
break
;
}
}
...
@@ -583,6 +584,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
...
@@ -583,6 +584,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
HRESULT
hr
;
HRESULT
hr
;
LPDIDATAFORMAT
df
=
NULL
;
LPDIDATAFORMAT
df
=
NULL
;
int
idx
=
0
;
int
idx
=
0
;
int
axis_map
[
8
];
/* max axes */
TRACE
(
"%s %p %p %p %hu
\n
"
,
debugstr_guid
(
rguid
),
jvt
,
dinput
,
pdev
,
index
);
TRACE
(
"%s %p %p %p %hu
\n
"
,
debugstr_guid
(
rguid
),
jvt
,
dinput
,
pdev
,
index
);
...
@@ -606,7 +608,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
...
@@ -606,7 +608,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
generic
.
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
);
newDevice
->
generic
.
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
);
strcpy
(
newDevice
->
generic
.
name
,
name
);
strcpy
(
newDevice
->
generic
.
name
,
name
);
get_osx_device_elements
(
newDevice
);
memset
(
axis_map
,
0
,
sizeof
(
axis_map
));
get_osx_device_elements
(
newDevice
,
axis_map
);
TRACE
(
"%i axes %i buttons %i povs
\n
"
,
newDevice
->
generic
.
devcaps
.
dwAxes
,
newDevice
->
generic
.
devcaps
.
dwButtons
,
newDevice
->
generic
.
devcaps
.
dwPOVs
);
TRACE
(
"%i axes %i buttons %i povs
\n
"
,
newDevice
->
generic
.
devcaps
.
dwAxes
,
newDevice
->
generic
.
devcaps
.
dwButtons
,
newDevice
->
generic
.
devcaps
.
dwPOVs
);
...
@@ -632,8 +635,20 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
...
@@ -632,8 +635,20 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
for
(
i
=
0
;
i
<
newDevice
->
generic
.
devcaps
.
dwAxes
;
i
++
)
for
(
i
=
0
;
i
<
newDevice
->
generic
.
devcaps
.
dwAxes
;
i
++
)
{
{
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
i
],
df
->
dwObjSize
);
int
wine_obj
=
-
1
;
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
i
)
|
DIDFT_ABSAXIS
;
switch
(
axis_map
[
i
])
{
case
kHIDUsage_GD_X
:
wine_obj
=
0
;
break
;
case
kHIDUsage_GD_Y
:
wine_obj
=
1
;
break
;
case
kHIDUsage_GD_Z
:
wine_obj
=
2
;
break
;
case
kHIDUsage_GD_Rx
:
wine_obj
=
3
;
break
;
case
kHIDUsage_GD_Ry
:
wine_obj
=
4
;
break
;
case
kHIDUsage_GD_Rz
:
wine_obj
=
5
;
break
;
}
if
(
wine_obj
<
0
)
continue
;
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
wine_obj
],
df
->
dwObjSize
);
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
wine_obj
)
|
DIDFT_ABSAXIS
;
}
}
for
(
i
=
0
;
i
<
newDevice
->
generic
.
devcaps
.
dwPOVs
;
i
++
)
for
(
i
=
0
;
i
<
newDevice
->
generic
.
devcaps
.
dwPOVs
;
i
++
)
...
...
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