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
f6351117
Commit
f6351117
authored
Sep 07, 2009
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Sep 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Move axes and buttons queries into initial joystick discovery for joydev driver.
parent
a188b56d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
joystick_linux.c
dlls/dinput/joystick_linux.c
+22
-20
No files found.
dlls/dinput/joystick_linux.c
View file @
f6351117
...
...
@@ -80,6 +80,8 @@ struct JoyDev
char
device
[
MAX_PATH
];
char
name
[
MAX_PATH
];
BYTE
axis_count
;
BYTE
button_count
;
BYTE
dev_axes_map
[
ABS_MAX
+
1
];
int
have_axes_map
;
};
...
...
@@ -135,6 +137,20 @@ static INT find_joystick_devices(void)
if
(
ioctl
(
fd
,
JSIOCGNAME
(
sizeof
(
joydev
.
name
)),
joydev
.
name
)
<
0
)
WARN
(
"ioctl(%s,JSIOCGNAME) failed: %s
\n
"
,
joydev
.
device
,
strerror
(
errno
));
#endif
#ifdef JSIOCGAXES
if
(
ioctl
(
fd
,
JSIOCGAXES
,
&
joydev
.
axis_count
)
<
0
)
{
WARN
(
"ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2
\n
"
,
joydev
.
device
,
strerror
(
errno
));
joydev
.
axis_count
=
2
;
}
#endif
#ifdef JSIOCGBUTTONS
if
(
ioctl
(
fd
,
JSIOCGBUTTONS
,
&
joydev
.
button_count
)
<
0
)
{
WARN
(
"ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2
\n
"
,
joydev
.
device
,
strerror
(
errno
));
joydev
.
button_count
=
2
;
}
#endif
if
(
ioctl
(
fd
,
JSIOCGAXMAP
,
joydev
.
dev_axes_map
)
<
0
)
{
...
...
@@ -168,6 +184,9 @@ static INT find_joystick_devices(void)
(
joystick_devices_count
+
1
)
*
sizeof
(
struct
JoyDev
));
if
(
!
new_joydevs
)
continue
;
TRACE
(
"Found a joystick on %s: %s
\n
with %d axes and %d buttons
\n
"
,
joydev
.
device
,
joydev
.
name
,
joydev
.
axis_count
,
joydev
.
button_count
);
joystick_devices
=
new_joydevs
;
joystick_devices
[
joystick_devices_count
++
]
=
joydev
;
}
...
...
@@ -279,31 +298,14 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
}
newDevice
->
joydev
=
&
joystick_devices
[
index
];
if
((
newDevice
->
joyfd
=
open
(
newDevice
->
joydev
->
device
,
O_RDONLY
))
<
0
)
{
WARN
(
"open(%s, O_RDONLY) failed: %s
\n
"
,
newDevice
->
joydev
->
device
,
strerror
(
errno
));
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
return
DIERR_DEVICENOTREG
;
}
newDevice
->
joyfd
=
-
1
;
newDevice
->
generic
.
guidInstance
=
DInput_Wine_Joystick_GUID
;
newDevice
->
generic
.
guidInstance
.
Data3
=
index
;
newDevice
->
generic
.
guidProduct
=
DInput_Wine_Joystick_GUID
;
newDevice
->
generic
.
joy_polldev
=
joy_polldev
;
newDevice
->
generic
.
name
=
newDevice
->
joydev
->
name
;
#ifdef JSIOCGAXES
if
(
ioctl
(
newDevice
->
joyfd
,
JSIOCGAXES
,
&
newDevice
->
generic
.
device_axis_count
)
<
0
)
{
WARN
(
"ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2
\n
"
,
newDevice
->
joydev
->
device
,
strerror
(
errno
));
newDevice
->
generic
.
device_axis_count
=
2
;
}
#endif
#ifdef JSIOCGBUTTONS
if
(
ioctl
(
newDevice
->
joyfd
,
JSIOCGBUTTONS
,
&
newDevice
->
generic
.
devcaps
.
dwButtons
)
<
0
)
{
WARN
(
"ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2
\n
"
,
newDevice
->
joydev
->
device
,
strerror
(
errno
));
newDevice
->
generic
.
devcaps
.
dwButtons
=
2
;
}
#endif
newDevice
->
generic
.
device_axis_count
=
newDevice
->
joydev
->
axis_count
;
newDevice
->
generic
.
devcaps
.
dwButtons
=
newDevice
->
joydev
->
button_count
;
if
(
newDevice
->
generic
.
devcaps
.
dwButtons
>
128
)
{
...
...
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