Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
bdbc2783
Commit
bdbc2783
authored
May 03, 2008
by
Vitaliy Margolen
Committed by
Alexandre Julliard
May 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Limit number of axes in a different way - map all extra axes to -1.
We can't stop device from sending us extra axes so have to keep axes mapping around for them.
parent
b07ff6ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
55 deletions
+47
-55
joystick_linux.c
dlls/dinput/joystick_linux.c
+47
-55
No files found.
dlls/dinput/joystick_linux.c
View file @
bdbc2783
...
...
@@ -289,70 +289,65 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
if
(
!
device
->
axis_map
)
return
DIERR_OUTOFMEMORY
;
if
(
!
get_config_key
(
hkey
,
appkey
,
device
->
name
,
buffer
,
MAX_PATH
))
{
static
const
char
*
axis_names
[]
=
{
"X"
,
"Y"
,
"Z"
,
"Rx"
,
"Ry"
,
"Rz"
,
"Slider1"
,
"Slider2"
,
"POV1"
,
"POV2"
,
"POV3"
,
"POV4"
};
const
char
*
delim
=
","
;
char
*
ptr
;
TRACE
(
"
\"
%s
\"
=
\"
%s
\"\n
"
,
device
->
name
,
buffer
);
if
((
ptr
=
strtok
(
buffer
,
delim
))
!=
NULL
)
{
do
{
if
(
strcmp
(
ptr
,
"X"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
0
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Y"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
1
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Z"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
2
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Rx"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
3
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Ry"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
4
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Rz"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
5
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Slider1"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
6
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"Slider2"
)
==
0
)
{
device
->
axis_map
[
tokens
]
=
7
;
axis
++
;
}
else
if
(
strcmp
(
ptr
,
"POV1"
)
==
0
)
{
device
->
axis_map
[
tokens
++
]
=
8
;
device
->
axis_map
[
tokens
]
=
8
;
pov
++
;
}
else
if
(
strcmp
(
ptr
,
"POV2"
)
==
0
)
{
device
->
axis_map
[
tokens
++
]
=
9
;
device
->
axis_map
[
tokens
]
=
9
;
pov
++
;
}
else
if
(
strcmp
(
ptr
,
"POV3"
)
==
0
)
{
device
->
axis_map
[
tokens
++
]
=
10
;
device
->
axis_map
[
tokens
]
=
10
;
pov
++
;
}
else
if
(
strcmp
(
ptr
,
"POV4"
)
==
0
)
{
device
->
axis_map
[
tokens
++
]
=
11
;
device
->
axis_map
[
tokens
]
=
11
;
pov
++
;
}
else
{
ERR
(
"invalid joystick axis type: %s
\n
"
,
ptr
);
device
->
axis_map
[
tokens
]
=
tokens
;
axis
++
;
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
axis_names
)
/
sizeof
(
axis_names
[
0
]);
i
++
)
if
(
!
strcmp
(
ptr
,
axis_names
[
i
]))
{
if
(
!
strncmp
(
ptr
,
"POV"
,
3
))
{
if
(
pov
>=
4
)
{
WARN
(
"Only 4 POVs supported - ignoring extra
\n
"
);
i
=
-
1
;
}
else
{
/* Pov takes two axes */
device
->
axis_map
[
tokens
++
]
=
i
;
pov
++
;
}
}
else
{
if
(
axis
>=
8
)
{
FIXME
(
"Only 8 Axes supported - ignoring extra
\n
"
);
i
=
-
1
;
}
else
axis
++
;
}
break
;
}
if
(
i
==
sizeof
(
axis_names
)
/
sizeof
(
axis_names
[
0
]))
{
ERR
(
"invalid joystick axis type:
\"
%s
\"\n
"
,
ptr
);
i
=
-
1
;
}
device
->
axis_map
[
tokens
]
=
i
;
tokens
++
;
}
while
((
ptr
=
strtok
(
NULL
,
delim
))
!=
NULL
);
if
(
tokens
!=
device
->
devcaps
.
dwA
xes
)
{
if
(
tokens
!=
device
->
a
xes
)
{
ERR
(
"not all joystick axes mapped: %d axes(%d,%d), %d arguments
\n
"
,
device
->
axes
,
axis
,
pov
,
tokens
);
while
(
tokens
<
device
->
axes
)
{
device
->
axis_map
[
tokens
]
=
tokens
;
device
->
axis_map
[
tokens
]
=
-
1
;
tokens
++
;
}
}
}
}
else
{
...
...
@@ -360,11 +355,13 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
{
if
(
tokens
<
8
)
device
->
axis_map
[
tokens
]
=
axis
++
;
else
else
if
(
tokens
<
16
)
{
device
->
axis_map
[
tokens
++
]
=
8
+
pov
;
device
->
axis_map
[
tokens
]
=
8
+
pov
++
;
}
else
device
->
axis_map
[
tokens
]
=
-
1
;
}
}
device
->
devcaps
.
dwAxes
=
axis
;
...
...
@@ -433,13 +430,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
}
#endif
if
(
newDevice
->
axes
>
16
)
{
/* There are 24 more axes for velocity that we can use */
FIXME
(
"Can't support %d axes. Clamping down to 16
\n
"
,
newDevice
->
axes
);
newDevice
->
axes
=
16
;
}
if
(
newDevice
->
devcaps
.
dwButtons
>
128
)
{
WARN
(
"Can't support %d buttons. Clamping down to 128
\n
"
,
newDevice
->
devcaps
.
dwButtons
);
...
...
@@ -472,6 +462,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
{
int
wine_obj
=
newDevice
->
axis_map
[
i
];
if
(
wine_obj
<
0
)
continue
;
memcpy
(
&
df
->
rgodf
[
idx
],
&
c_dfDIJoystick2
.
rgodf
[
wine_obj
],
df
->
dwObjSize
);
if
(
wine_obj
<
8
)
df
->
rgodf
[
idx
++
].
dwType
=
DIDFT_MAKEINSTANCE
(
wine_obj
)
|
DIDFT_ABSAXIS
;
...
...
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