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
27ea33ba
Commit
27ea33ba
authored
May 27, 2021
by
Rémi Bernon
Committed by
Alexandre Julliard
May 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Factor out IDirectInputDevice_GetDeviceInfo WtoA conversions.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7713050c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
40 additions
and
134 deletions
+40
-134
ansi.c
dlls/dinput/ansi.c
+34
-0
device_private.h
dlls/dinput/device_private.h
+1
-0
joystick.c
dlls/dinput/joystick.c
+0
-48
joystick_linux.c
dlls/dinput/joystick_linux.c
+1
-25
joystick_linuxinput.c
dlls/dinput/joystick_linuxinput.c
+1
-26
joystick_osx.c
dlls/dinput/joystick_osx.c
+1
-6
joystick_private.h
dlls/dinput/joystick_private.h
+0
-3
keyboard.c
dlls/dinput/keyboard.c
+1
-13
mouse.c
dlls/dinput/mouse.c
+1
-13
No files found.
dlls/dinput/ansi.c
View file @
27ea33ba
...
...
@@ -64,6 +64,23 @@ static void dideviceobjectinstance_wtoa( const DIDEVICEOBJECTINSTANCEW *in, DIDE
out
->
wReserved
=
in
->
wReserved
;
}
static
void
dideviceinstance_wtoa
(
const
DIDEVICEINSTANCEW
*
in
,
DIDEVICEINSTANCEA
*
out
)
{
out
->
guidInstance
=
in
->
guidInstance
;
out
->
guidProduct
=
in
->
guidProduct
;
out
->
dwDevType
=
in
->
dwDevType
;
WideCharToMultiByte
(
CP_ACP
,
0
,
in
->
tszInstanceName
,
-
1
,
out
->
tszInstanceName
,
sizeof
(
out
->
tszInstanceName
),
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
in
->
tszProductName
,
-
1
,
out
->
tszProductName
,
sizeof
(
out
->
tszProductName
),
NULL
,
NULL
);
if
(
out
->
dwSize
<=
FIELD_OFFSET
(
DIDEVICEINSTANCEA
,
guidFFDriver
))
return
;
out
->
guidFFDriver
=
in
->
guidFFDriver
;
out
->
wUsagePage
=
in
->
wUsagePage
;
out
->
wUsage
=
in
->
wUsage
;
}
static
void
dieffectinfo_wtoa
(
const
DIEFFECTINFOW
*
in
,
DIEFFECTINFOA
*
out
)
{
out
->
guid
=
in
->
guid
;
...
...
@@ -247,6 +264,23 @@ HRESULT WINAPI IDirectInputDevice2AImpl_GetObjectInfo( IDirectInputDevice8A *ifa
return
hr
;
}
HRESULT
WINAPI
IDirectInputDevice2AImpl_GetDeviceInfo
(
IDirectInputDevice8A
*
iface_a
,
DIDEVICEINSTANCEA
*
instance_a
)
{
IDirectInputDeviceImpl
*
impl
=
impl_from_IDirectInputDevice8A
(
iface_a
);
IDirectInputDevice8W
*
iface_w
=
IDirectInputDevice8W_from_impl
(
impl
);
DIDEVICEINSTANCEW
instance_w
=
{
sizeof
(
instance_w
)};
HRESULT
hr
;
if
(
!
instance_a
)
return
E_POINTER
;
if
(
instance_a
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEA
)
&&
instance_a
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3A
))
return
DIERR_INVALIDPARAM
;
hr
=
IDirectInputDevice8_GetDeviceInfo
(
iface_w
,
&
instance_w
);
dideviceinstance_wtoa
(
&
instance_w
,
instance_a
);
return
hr
;
}
HRESULT
WINAPI
IDirectInputDevice2AImpl_RunControlPanel
(
IDirectInputDevice8A
*
iface_a
,
HWND
owner
,
DWORD
flags
)
{
IDirectInputDeviceImpl
*
impl
=
impl_from_IDirectInputDevice8A
(
iface_a
);
...
...
dlls/dinput/device_private.h
View file @
27ea33ba
...
...
@@ -173,6 +173,7 @@ extern HRESULT WINAPI IDirectInputDevice2WImpl_GetObjectInfo(LPDIRECTINPUTDEVICE
LPDIDEVICEOBJECTINSTANCEW
pdidoi
,
DWORD
dwObj
,
DWORD
dwHow
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirectInputDevice2AImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
DIDEVICEINSTANCEA
*
instance
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirectInputDevice2AImpl_GetDeviceData
(
LPDIRECTINPUTDEVICE8A
iface
,
DWORD
dodsize
,
LPDIDEVICEOBJECTDATA
dod
,
LPDWORD
entries
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
extern
HRESULT
WINAPI
IDirectInputDevice2WImpl_GetDeviceData
(
LPDIRECTINPUTDEVICE8W
iface
,
DWORD
dodsize
,
LPDIDEVICEOBJECTDATA
dod
,
...
...
dlls/dinput/joystick.c
View file @
27ea33ba
...
...
@@ -640,54 +640,6 @@ HRESULT WINAPI JoystickWGenericImpl_GetProperty(LPDIRECTINPUTDEVICE8W iface, REF
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
HRESULT
WINAPI
JoystickAGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
{
JoystickGenericImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
DIPROPDWORD
pd
;
DWORD
index
=
0
;
TRACE
(
"(%p,%p)
\n
"
,
This
,
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
;
}
/* Try to get joystick index */
pd
.
diph
.
dwSize
=
sizeof
(
pd
);
pd
.
diph
.
dwHeaderSize
=
sizeof
(
pd
.
diph
);
pd
.
diph
.
dwObj
=
0
;
pd
.
diph
.
dwHow
=
DIPH_DEVICE
;
if
(
SUCCEEDED
(
IDirectInputDevice2_GetProperty
(
iface
,
DIPROP_JOYSTICKID
,
&
pd
.
diph
)))
index
=
pd
.
dwData
;
/* Return joystick */
pdidi
->
guidInstance
=
This
->
base
.
guid
;
pdidi
->
guidProduct
=
This
->
guidProduct
;
/* we only support traditional joysticks for now */
pdidi
->
dwDevType
=
This
->
devcaps
.
dwDevType
;
snprintf
(
pdidi
->
tszInstanceName
,
MAX_PATH
,
"Joystick %d"
,
index
);
lstrcpynA
(
pdidi
->
tszProductName
,
This
->
name
,
MAX_PATH
);
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
)
...
...
dlls/dinput/joystick_linux.c
View file @
27ea33ba
...
...
@@ -103,11 +103,6 @@ struct JoystickImpl
POINTL
povs
[
4
];
};
static
inline
JoystickImpl
*
impl_from_IDirectInputDevice8A
(
IDirectInputDevice8A
*
iface
)
{
return
CONTAINING_RECORD
(
CONTAINING_RECORD
(
CONTAINING_RECORD
(
iface
,
IDirectInputDeviceImpl
,
IDirectInputDevice8A_iface
),
JoystickGenericImpl
,
base
),
JoystickImpl
,
generic
);
}
static
inline
JoystickImpl
*
impl_from_IDirectInputDevice8W
(
IDirectInputDevice8W
*
iface
)
{
return
CONTAINING_RECORD
(
CONTAINING_RECORD
(
CONTAINING_RECORD
(
iface
,
IDirectInputDeviceImpl
,
IDirectInputDevice8W_iface
),
...
...
@@ -764,25 +759,6 @@ static HRESULT WINAPI JoystickLinuxWImpl_GetProperty(LPDIRECTINPUTDEVICE8W 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
)
);
ddi
->
guidInstance
=
This
->
generic
.
base
.
guid
;
return
DI_OK
;
}
static
HRESULT
WINAPI
JoystickLinuxWImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
ddi
)
{
JoystickImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
...
...
@@ -919,7 +895,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2AImpl_GetObjectInfo
,
JoystickLinux
AImpl_GetDeviceInfo
,
IDirectInputDevice2
AImpl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_CreateEffect
,
...
...
dlls/dinput/joystick_linuxinput.c
View file @
27ea33ba
...
...
@@ -136,11 +136,6 @@ struct JoystickImpl
int
ff_gain
;
};
static
inline
JoystickImpl
*
impl_from_IDirectInputDevice8A
(
IDirectInputDevice8A
*
iface
)
{
return
CONTAINING_RECORD
(
CONTAINING_RECORD
(
CONTAINING_RECORD
(
iface
,
IDirectInputDeviceImpl
,
IDirectInputDevice8A_iface
),
JoystickGenericImpl
,
base
),
JoystickImpl
,
generic
);
}
static
inline
JoystickImpl
*
impl_from_IDirectInputDevice8W
(
IDirectInputDevice8W
*
iface
)
{
return
CONTAINING_RECORD
(
CONTAINING_RECORD
(
CONTAINING_RECORD
(
iface
,
IDirectInputDeviceImpl
,
IDirectInputDevice8W_iface
),
...
...
@@ -1293,26 +1288,6 @@ static HRESULT WINAPI JoystickWImpl_EnumCreatedEffectObjects(LPDIRECTINPUTDEVICE
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
static
HRESULT
WINAPI
JoystickAImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
{
JoystickImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
TRACE
(
"(%p) %p
\n
"
,
This
,
pdidi
);
if
(
pdidi
==
NULL
)
return
E_POINTER
;
if
((
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCE_DX3A
))
&&
(
pdidi
->
dwSize
!=
sizeof
(
DIDEVICEINSTANCEA
)))
return
DIERR_INVALIDPARAM
;
fill_joystick_dideviceinstanceA
(
pdidi
,
This
->
generic
.
base
.
dinput
->
dwVersion
,
get_joystick_index
(
&
This
->
generic
.
base
.
guid
));
pdidi
->
guidInstance
=
This
->
generic
.
base
.
guid
;
return
DI_OK
;
}
static
HRESULT
WINAPI
JoystickWImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
)
{
...
...
@@ -1350,7 +1325,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2AImpl_GetObjectInfo
,
Joystick
AImpl_GetDeviceInfo
,
IDirectInputDevice2
AImpl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_CreateEffect
,
...
...
dlls/dinput/joystick_osx.c
View file @
27ea33ba
...
...
@@ -116,11 +116,6 @@ struct JoystickImpl
struct
list
effects
;
};
static
inline
JoystickImpl
*
impl_from_IDirectInputDevice8A
(
IDirectInputDevice8A
*
iface
)
{
return
CONTAINING_RECORD
(
CONTAINING_RECORD
(
CONTAINING_RECORD
(
iface
,
IDirectInputDeviceImpl
,
IDirectInputDevice8A_iface
),
JoystickGenericImpl
,
base
),
JoystickImpl
,
generic
);
}
static
inline
JoystickImpl
*
impl_from_IDirectInputDevice8W
(
IDirectInputDevice8W
*
iface
)
{
return
CONTAINING_RECORD
(
CONTAINING_RECORD
(
CONTAINING_RECORD
(
iface
,
IDirectInputDeviceImpl
,
IDirectInputDevice8W_iface
),
...
...
@@ -1591,7 +1586,7 @@ static const IDirectInputDevice8AVtbl JoystickAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2AImpl_GetObjectInfo
,
JoystickAGeneric
Impl_GetDeviceInfo
,
IDirectInputDevice2A
Impl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_CreateEffect
,
...
...
dlls/dinput/joystick_private.h
View file @
27ea33ba
...
...
@@ -70,9 +70,6 @@ void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) DECLSPEC_HIDDEN;
HRESULT
WINAPI
JoystickWGenericImpl_SetProperty
(
LPDIRECTINPUTDEVICE8W
iface
,
REFGUID
rguid
,
LPCDIPROPHEADER
ph
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
JoystickAGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
JoystickWGenericImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
)
DECLSPEC_HIDDEN
;
...
...
dlls/dinput/keyboard.c
View file @
27ea33ba
...
...
@@ -471,18 +471,6 @@ static HRESULT WINAPI SysKeyboardWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
static
HRESULT
WINAPI
SysKeyboardAImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
TRACE
(
"(this=%p,%p)
\n
"
,
This
,
pdidi
);
fill_keyboard_dideviceinstanceA
(
pdidi
,
This
->
base
.
dinput
->
dwVersion
,
This
->
subtype
);
return
DI_OK
;
}
static
HRESULT
WINAPI
SysKeyboardWImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
)
{
SysKeyboardImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
...
...
@@ -653,7 +641,7 @@ static const IDirectInputDevice8AVtbl SysKeyboardAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2AImpl_GetObjectInfo
,
SysKeyboard
AImpl_GetDeviceInfo
,
IDirectInputDevice2
AImpl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_CreateEffect
,
...
...
dlls/dinput/mouse.c
View file @
27ea33ba
...
...
@@ -782,18 +782,6 @@ static HRESULT WINAPI SysMouseWImpl_GetObjectInfo(LPDIRECTINPUTDEVICE8W iface,
/******************************************************************************
* GetDeviceInfo : get information about a device's identity
*/
static
HRESULT
WINAPI
SysMouseAImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8A
iface
,
LPDIDEVICEINSTANCEA
pdidi
)
{
SysMouseImpl
*
This
=
impl_from_IDirectInputDevice8A
(
iface
);
TRACE
(
"(this=%p,%p)
\n
"
,
This
,
pdidi
);
fill_mouse_dideviceinstanceA
(
pdidi
,
This
->
base
.
dinput
->
dwVersion
);
return
DI_OK
;
}
static
HRESULT
WINAPI
SysMouseWImpl_GetDeviceInfo
(
LPDIRECTINPUTDEVICE8W
iface
,
LPDIDEVICEINSTANCEW
pdidi
)
{
SysMouseImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
...
...
@@ -906,7 +894,7 @@ static const IDirectInputDevice8AVtbl SysMouseAvt =
IDirectInputDevice2AImpl_SetEventNotification
,
IDirectInputDevice2AImpl_SetCooperativeLevel
,
IDirectInputDevice2AImpl_GetObjectInfo
,
SysMouse
AImpl_GetDeviceInfo
,
IDirectInputDevice2
AImpl_GetDeviceInfo
,
IDirectInputDevice2AImpl_RunControlPanel
,
IDirectInputDevice2AImpl_Initialize
,
IDirectInputDevice2AImpl_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