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
93f40b2e
Commit
93f40b2e
authored
Feb 24, 2015
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Implement GetDeviceInfo for Linux joystick.
parent
5a6cda45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
31 deletions
+85
-31
joystick_linux.c
dlls/dinput/joystick_linux.c
+85
-31
No files found.
dlls/dinput/joystick_linux.c
View file @
93f40b2e
...
...
@@ -223,6 +223,52 @@ static INT find_joystick_devices(void)
return
joystick_devices_count
;
}
static
void
fill_joystick_dideviceinstanceA
(
LPDIDEVICEINSTANCEA
lpddi
,
DWORD
version
,
int
id
)
{
DWORD
dwSize
=
lpddi
->
dwSize
;
TRACE
(
"%d %p
\n
"
,
dwSize
,
lpddi
);
memset
(
lpddi
,
0
,
dwSize
);
/* Return joystick */
lpddi
->
dwSize
=
dwSize
;
lpddi
->
guidInstance
=
DInput_Wine_Joystick_GUID
;
lpddi
->
guidInstance
.
Data3
=
id
;
lpddi
->
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* we only support traditional joysticks for now */
if
(
version
>=
0x0800
)
lpddi
->
dwDevType
=
DI8DEVTYPE_JOYSTICK
|
(
DI8DEVTYPEJOYSTICK_STANDARD
<<
8
);
else
lpddi
->
dwDevType
=
DIDEVTYPE_JOYSTICK
|
(
DIDEVTYPEJOYSTICK_TRADITIONAL
<<
8
);
strcpy
(
lpddi
->
tszInstanceName
,
joystick_devices
[
id
].
name
);
strcpy
(
lpddi
->
tszProductName
,
joystick_devices
[
id
].
name
);
lpddi
->
guidFFDriver
=
GUID_NULL
;
}
static
void
fill_joystick_dideviceinstanceW
(
LPDIDEVICEINSTANCEW
lpddi
,
DWORD
version
,
int
id
)
{
DWORD
dwSize
=
lpddi
->
dwSize
;
TRACE
(
"%d %p
\n
"
,
dwSize
,
lpddi
);
memset
(
lpddi
,
0
,
dwSize
);
/* Return joystick */
lpddi
->
dwSize
=
dwSize
;
lpddi
->
guidInstance
=
DInput_Wine_Joystick_GUID
;
lpddi
->
guidInstance
.
Data3
=
id
;
lpddi
->
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* we only support traditional joysticks for now */
if
(
version
>=
0x0800
)
lpddi
->
dwDevType
=
DI8DEVTYPE_JOYSTICK
|
(
DI8DEVTYPEJOYSTICK_STANDARD
<<
8
);
else
lpddi
->
dwDevType
=
DIDEVTYPE_JOYSTICK
|
(
DIDEVTYPEJOYSTICK_TRADITIONAL
<<
8
);
MultiByteToWideChar
(
CP_ACP
,
0
,
joystick_devices
[
id
].
name
,
-
1
,
lpddi
->
tszInstanceName
,
MAX_PATH
);
MultiByteToWideChar
(
CP_ACP
,
0
,
joystick_devices
[
id
].
name
,
-
1
,
lpddi
->
tszProductName
,
MAX_PATH
);
lpddi
->
guidFFDriver
=
GUID_NULL
;
}
static
HRESULT
joydev_enum_deviceA
(
DWORD
dwDevType
,
DWORD
dwFlags
,
LPDIDEVICEINSTANCEA
lpddi
,
DWORD
version
,
int
id
)
{
int
fd
=
-
1
;
...
...
@@ -243,21 +289,7 @@ static HRESULT joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
WARN
(
"open(%s, O_RDONLY) failed: %s
\n
"
,
joystick_devices
[
id
].
name
,
strerror
(
errno
));
return
S_FALSE
;
}
/* Return joystick */
lpddi
->
guidInstance
=
DInput_Wine_Joystick_GUID
;
lpddi
->
guidInstance
.
Data3
=
id
;
lpddi
->
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* we only support traditional joysticks for now */
if
(
version
>=
0x0800
)
lpddi
->
dwDevType
=
DI8DEVTYPE_JOYSTICK
|
(
DI8DEVTYPEJOYSTICK_STANDARD
<<
8
);
else
lpddi
->
dwDevType
=
DIDEVTYPE_JOYSTICK
|
(
DIDEVTYPEJOYSTICK_TRADITIONAL
<<
8
);
strcpy
(
lpddi
->
tszInstanceName
,
joystick_devices
[
id
].
name
);
strcpy
(
lpddi
->
tszProductName
,
joystick_devices
[
id
].
name
);
lpddi
->
guidFFDriver
=
GUID_NULL
;
fill_joystick_dideviceinstanceA
(
lpddi
,
version
,
id
);
close
(
fd
);
TRACE
(
"Enumerating the linux Joystick device: %s (%s)
\n
"
,
joystick_devices
[
id
].
device
,
lpddi
->
tszProductName
);
return
S_OK
;
...
...
@@ -286,20 +318,7 @@ static HRESULT joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINS
WARN
(
"open(%s,O_RDONLY) failed: %s
\n
"
,
joystick_devices
[
id
].
device
,
strerror
(
errno
));
return
S_FALSE
;
}
/* Return joystick */
lpddi
->
guidInstance
=
DInput_Wine_Joystick_GUID
;
lpddi
->
guidInstance
.
Data3
=
id
;
lpddi
->
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* we only support traditional joysticks for now */
if
(
version
>=
0x0800
)
lpddi
->
dwDevType
=
DI8DEVTYPE_JOYSTICK
|
(
DI8DEVTYPEJOYSTICK_STANDARD
<<
8
);
else
lpddi
->
dwDevType
=
DIDEVTYPE_JOYSTICK
|
(
DIDEVTYPEJOYSTICK_TRADITIONAL
<<
8
);
MultiByteToWideChar
(
CP_ACP
,
0
,
joystick_devices
[
id
].
name
,
-
1
,
lpddi
->
tszInstanceName
,
MAX_PATH
);
MultiByteToWideChar
(
CP_ACP
,
0
,
joystick_devices
[
id
].
name
,
-
1
,
lpddi
->
tszProductName
,
MAX_PATH
);
lpddi
->
guidFFDriver
=
GUID_NULL
;
fill_joystick_dideviceinstanceW
(
lpddi
,
version
,
id
);
close
(
fd
);
TRACE
(
"Enumerating the linux Joystick device: %s (%s)
\n
"
,
joystick_devices
[
id
].
device
,
joystick_devices
[
id
].
name
);
return
S_OK
;
...
...
@@ -591,6 +610,41 @@ static HRESULT WINAPI JoystickLinuxAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface
}
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
static
HRESULT
WINAPI
JoystickLinuxAImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
ddi
)
{
JoystickImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
TRACE
(
"(%p) %p
\n
"
,
This
,
ddi
);
if
(
ddi
==
NULL
)
return
E_POINTER
;
if
((
ddi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3A
))
&&
(
ddi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEA
)))
return
DIERR_INVALIDPARAM
;
fill_joystick_dideviceinstanceA
(
ddi
,
This
->
generic
.
base
.
dinput
->
dwVersion
,
get_joystick_index
(
&
This
->
generic
.
base
.
guid
)
);
return
DI_OK
;
}
static
HRESULT
WINAPI
JoystickLinuxWImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
ddi
)
{
JoystickImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
TRACE
(
"(%p) %p
\n
"
,
This
,
ddi
);
if
(
ddi
==
NULL
)
return
E_POINTER
;
if
((
ddi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3W
))
&&
(
ddi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEW
)))
return
DIERR_INVALIDPARAM
;
fill_joystick_dideviceinstanceW
(
ddi
,
This
->
generic
.
base
.
dinput
->
dwVersion
,
get_joystick_index
(
&
This
->
generic
.
base
.
guid
)
);
return
DI_OK
;
}
/******************************************************************************
* Unacquire : frees the joystick
*/
static
HRESULT
WINAPI
JoystickLinuxWImpl_Unacquire
(
LPDIRECTINPUTDEVICE8W
iface
)
...
...
@@ -713,7 +767,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
JoystickAGenericImpl_GetObjectInfo
,
Joystick
AGeneric
Impl_GetDeviceInfo
,
Joystick
LinuxA
Impl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_CreateEffect
,
...
...
@@ -749,7 +803,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
IDirectInputDevice2WImpl_SetEventNotification
,
IDirectInputDevice2WImpl_SetCooperativeLevel
,
JoystickWGenericImpl_GetObjectInfo
,
Joystick
WGeneric
Impl_GetDeviceInfo
,
Joystick
LinuxW
Impl_GetDeviceInfo
,
IDirectInputDevice2WImpl_RunControlPanel
,
IDirectInputDevice2WImpl_Initialize
,
IDirectInputDevice2WImpl_CreateEffect
,
...
...
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