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
cbd34748
Commit
cbd34748
authored
Mar 09, 2009
by
Aric Stewart
Committed by
Alexandre Julliard
Mar 10, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Move joystick productGuid and Name to the generic part.
parent
620839d2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
80 deletions
+87
-80
joystick.c
dlls/dinput/joystick.c
+71
-0
joystick_linux.c
dlls/dinput/joystick_linux.c
+9
-80
joystick_private.h
dlls/dinput/joystick_private.h
+7
-0
No files found.
dlls/dinput/joystick.c
View file @
cbd34748
...
...
@@ -274,3 +274,74 @@ HRESULT WINAPI JoystickAGenericImpl_GetProperty(
return
DI_OK
;
}
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
HRESULT
WINAPI
JoystickAGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
{
JoystickGenericImpl
*
This
=
(
JoystickGenericImpl
*
)
iface
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pdidi
);
if
(
pdidi
==
NULL
)
{
WARN
(
"invalid pointer
\n
"
);
return
E_POINTER
;
}
if
((
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3A
))
&&
(
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEA
)))
{
WARN
(
"invalid parameter: pdidi->dwSize = %d
\n
"
,
pdidi
->
dwSize
);
return
DIERR_INVALIDPARAM
;
}
/* Return joystick */
pdidi
->
guidInstance
=
GUID_Joystick
;
pdidi
->
guidProduct
=
This
->
guidProduct
;
/* we only support traditional joysticks for now */
pdidi
->
dwDevType
=
This
->
devcaps
.
dwDevType
;
strcpy
(
pdidi
->
tszInstanceName
,
"Joystick"
);
strcpy
(
pdidi
->
tszProductName
,
This
->
name
);
if
(
pdidi
->
dwSize
>
sizeof
(
DIDEVICEINSTANCE_DX3A
))
{
pdidi
->
guidFFDriver
=
GUID_NULL
;
pdidi
->
wUsagePage
=
0
;
pdidi
->
wUsage
=
0
;
}
return
DI_OK
;
}
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
HRESULT
WINAPI
JoystickWGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
)
{
JoystickGenericImpl
*
This
=
(
JoystickGenericImpl
*
)
iface
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pdidi
);
if
((
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3W
))
&&
(
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEW
)))
{
WARN
(
"invalid parameter: pdidi->dwSize = %d
\n
"
,
pdidi
->
dwSize
);
return
DIERR_INVALIDPARAM
;
}
/* Return joystick */
pdidi
->
guidInstance
=
GUID_Joystick
;
pdidi
->
guidProduct
=
This
->
guidProduct
;
/* we only support traditional joysticks for now */
pdidi
->
dwDevType
=
This
->
devcaps
.
dwDevType
;
MultiByteToWideChar
(
CP_ACP
,
0
,
"Joystick"
,
-
1
,
pdidi
->
tszInstanceName
,
MAX_PATH
);
MultiByteToWideChar
(
CP_ACP
,
0
,
This
->
name
,
-
1
,
pdidi
->
tszProductName
,
MAX_PATH
);
if
(
pdidi
->
dwSize
>
sizeof
(
DIDEVICEINSTANCE_DX3W
))
{
pdidi
->
guidFFDriver
=
GUID_NULL
;
pdidi
->
wUsagePage
=
0
;
pdidi
->
wUsage
=
0
;
}
return
DI_OK
;
}
dlls/dinput/joystick_linux.c
View file @
cbd34748
...
...
@@ -88,7 +88,6 @@ struct JoystickImpl
/* joystick private */
int
joyfd
;
DIJOYSTATE2
js
;
/* wine data */
char
*
name
;
LONG
deadzone
;
int
*
axis_map
;
int
axes
;
...
...
@@ -264,13 +263,13 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
device
->
axis_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
axes
*
sizeof
(
int
));
if
(
!
device
->
axis_map
)
return
DIERR_OUTOFMEMORY
;
if
(
!
get_config_key
(
hkey
,
appkey
,
device
->
name
,
buffer
,
MAX_PATH
))
{
if
(
!
get_config_key
(
hkey
,
appkey
,
device
->
generic
.
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
);
TRACE
(
"
\"
%s
\"
=
\"
%s
\"\n
"
,
device
->
generic
.
name
,
buffer
);
if
((
ptr
=
strtok
(
buffer
,
delim
))
!=
NULL
)
{
do
{
...
...
@@ -379,6 +378,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
return
DIERR_DEVICENOTREG
;
}
newDevice
->
generic
.
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* get the device name */
#if defined(JSIOCGNAME)
if
(
ioctl
(
newDevice
->
joyfd
,
JSIOCGNAME
(
MAX_PATH
),
name
)
<
0
)
{
...
...
@@ -390,8 +391,8 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
#endif
/* copy the device name */
newDevice
->
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
);
strcpy
(
newDevice
->
name
,
name
);
newDevice
->
generic
.
name
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
name
)
+
1
);
strcpy
(
newDevice
->
generic
.
name
,
name
);
#ifdef JSIOCGAXES
if
(
ioctl
(
newDevice
->
joyfd
,
JSIOCGAXES
,
&
newDevice
->
axes
)
<
0
)
{
...
...
@@ -504,7 +505,7 @@ FAILED1:
HeapFree
(
GetProcessHeap
(),
0
,
df
);
release_DataFormat
(
&
newDevice
->
generic
.
base
.
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
axis_map
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
name
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
generic
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
generic
.
props
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
*
pdev
=
0
;
...
...
@@ -763,78 +764,6 @@ static HRESULT WINAPI JoystickAImpl_Poll(LPDIRECTINPUTDEVICE8A iface)
return
DI_OK
;
}
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
static
HRESULT
WINAPI
JoystickAImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
{
JoystickImpl
*
This
=
(
JoystickImpl
*
)
iface
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pdidi
);
if
(
pdidi
==
NULL
)
{
WARN
(
"invalid pointer
\n
"
);
return
E_POINTER
;
}
if
((
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3A
))
&&
(
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEA
)))
{
WARN
(
"invalid parameter: pdidi->dwSize = %d
\n
"
,
pdidi
->
dwSize
);
return
DIERR_INVALIDPARAM
;
}
/* Return joystick */
pdidi
->
guidInstance
=
GUID_Joystick
;
pdidi
->
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* we only support traditional joysticks for now */
pdidi
->
dwDevType
=
This
->
generic
.
devcaps
.
dwDevType
;
strcpy
(
pdidi
->
tszInstanceName
,
"Joystick"
);
strcpy
(
pdidi
->
tszProductName
,
This
->
name
);
if
(
pdidi
->
dwSize
>
sizeof
(
DIDEVICEINSTANCE_DX3A
))
{
pdidi
->
guidFFDriver
=
GUID_NULL
;
pdidi
->
wUsagePage
=
0
;
pdidi
->
wUsage
=
0
;
}
return
DI_OK
;
}
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
static
HRESULT
WINAPI
JoystickWImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
)
{
JoystickImpl
*
This
=
(
JoystickImpl
*
)
iface
;
TRACE
(
"(%p,%p)
\n
"
,
iface
,
pdidi
);
if
((
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3W
))
&&
(
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEW
)))
{
WARN
(
"invalid parameter: pdidi->dwSize = %d
\n
"
,
pdidi
->
dwSize
);
return
DIERR_INVALIDPARAM
;
}
/* Return joystick */
pdidi
->
guidInstance
=
GUID_Joystick
;
pdidi
->
guidProduct
=
DInput_Wine_Joystick_GUID
;
/* we only support traditional joysticks for now */
pdidi
->
dwDevType
=
This
->
generic
.
devcaps
.
dwDevType
;
MultiByteToWideChar
(
CP_ACP
,
0
,
"Joystick"
,
-
1
,
pdidi
->
tszInstanceName
,
MAX_PATH
);
MultiByteToWideChar
(
CP_ACP
,
0
,
This
->
name
,
-
1
,
pdidi
->
tszProductName
,
MAX_PATH
);
if
(
pdidi
->
dwSize
>
sizeof
(
DIDEVICEINSTANCE_DX3W
))
{
pdidi
->
guidFFDriver
=
GUID_NULL
;
pdidi
->
wUsagePage
=
0
;
pdidi
->
wUsage
=
0
;
}
return
DI_OK
;
}
static
const
IDirectInputDevice8AVtbl
JoystickAvt
=
{
IDirectInputDevice2AImpl_QueryInterface
,
...
...
@@ -852,7 +781,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
JoystickAGenericImpl_GetObjectInfo
,
JoystickAImpl_GetDeviceInfo
,
JoystickA
Generic
Impl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_CreateEffect
,
...
...
@@ -894,7 +823,7 @@ static const IDirectInputDevice8WVtbl JoystickWvt =
XCAST
(
SetEventNotification
)
IDirectInputDevice2AImpl_SetEventNotification
,
XCAST
(
SetCooperativeLevel
)
IDirectInputDevice2AImpl_SetCooperativeLevel
,
JoystickWGenericImpl_GetObjectInfo
,
JoystickWImpl_GetDeviceInfo
,
JoystickW
Generic
Impl_GetDeviceInfo
,
XCAST
(
RunControlPanel
)
IDirectInputDevice2AImpl_RunControlPanel
,
XCAST
(
Initialize
)
IDirectInputDevice2AImpl_Initialize
,
XCAST
(
CreateEffect
)
IDirectInputDevice2AImpl_CreateEffect
,
...
...
dlls/dinput/joystick_private.h
View file @
cbd34748
...
...
@@ -35,6 +35,8 @@ typedef struct JoystickGenericImpl
ObjProps
*
props
;
DIDEVCAPS
devcaps
;
GUID
guidProduct
;
char
*
name
;
}
JoystickGenericImpl
;
...
...
@@ -55,5 +57,10 @@ void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps);
HRESULT
WINAPI
JoystickAGenericImpl_SetProperty
(
LPDIRECTINPUTDEVICE8A
iface
,
REFGUID
rguid
,
LPCDIPROPHEADER
ph
);
HRESULT
WINAPI
JoystickAGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
);
HRESULT
WINAPI
JoystickWGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
);
#endif
/* __WINE_DLLS_DINPUT_JOYSTICK_PRIVATE_H */
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