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
31fdae5b
Commit
31fdae5b
authored
Jul 21, 2011
by
Lucas Fialho Zawacki
Committed by
Alexandre Julliard
Jul 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: BuildActionMap for all joysticks. For the moment only for buttons and axis.
parent
6e098f90
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
1 deletion
+64
-1
device.c
dlls/dinput/device.c
+23
-0
device_private.h
dlls/dinput/device_private.h
+1
-0
dinput_private.h
dlls/dinput/dinput_private.h
+1
-0
joystick.c
dlls/dinput/joystick.c
+39
-1
No files found.
dlls/dinput/device.c
View file @
31fdae5b
...
...
@@ -366,6 +366,29 @@ static inline LPDIOBJECTDATAFORMAT dataformat_to_odf(LPCDIDATAFORMAT df, int idx
return
(
LPDIOBJECTDATAFORMAT
)((
LPBYTE
)
df
->
rgodf
+
idx
*
df
->
dwObjSize
);
}
/* dataformat_to_odf_by_type
* Find the Nth object of the selected type in the DataFormat
*/
LPDIOBJECTDATAFORMAT
dataformat_to_odf_by_type
(
LPCDIDATAFORMAT
df
,
int
n
,
DWORD
type
)
{
int
i
,
nfound
=
0
;
for
(
i
=
0
;
i
<
df
->
dwNumObjs
;
i
++
)
{
LPDIOBJECTDATAFORMAT
odf
=
dataformat_to_odf
(
df
,
i
);
if
(
odf
->
dwType
&
type
)
{
if
(
n
==
nfound
)
return
odf
;
nfound
++
;
}
}
return
NULL
;
}
static
HRESULT
create_DataFormat
(
LPCDIDATAFORMAT
asked_format
,
DataFormat
*
format
)
{
DataTransform
*
dt
;
...
...
dlls/dinput/device_private.h
View file @
31fdae5b
...
...
@@ -125,6 +125,7 @@ extern void _dump_DIDATAFORMAT(const DIDATAFORMAT *df) DECLSPEC_HIDDEN;
extern
const
char
*
_dump_dinput_GUID
(
const
GUID
*
guid
)
DECLSPEC_HIDDEN
;
extern
DWORD
semantic_to_obj_id
(
IDirectInputDeviceImpl
*
This
,
DWORD
dwSemantic
)
DECLSPEC_HIDDEN
;
extern
LPDIOBJECTDATAFORMAT
dataformat_to_odf_by_type
(
LPCDIDATAFORMAT
df
,
int
n
,
DWORD
type
)
DECLSPEC_HIDDEN
;
/* And the stubs */
extern
HRESULT
WINAPI
IDirectInputDevice2AImpl_Acquire
(
LPDIRECTINPUTDEVICE8A
iface
)
DECLSPEC_HIDDEN
;
...
...
dlls/dinput/dinput_private.h
View file @
31fdae5b
...
...
@@ -71,5 +71,6 @@ extern void _copy_diactionformatWtoA(LPDIACTIONFORMATA, LPDIACTIONFORMATW) DECLS
#define DIKEYBOARD_MASK 0x81000000
#define DIMOUSE_MASK 0x82000000
#define DIGENRE_ANY 0xFF000000
#endif
/* __WINE_DLLS_DINPUT_DINPUT_PRIVATE_H */
dlls/dinput/joystick.c
View file @
31fdae5b
...
...
@@ -432,9 +432,47 @@ HRESULT WINAPI JoystickWGenericImpl_BuildActionMap(LPDIRECTINPUTDEVICE8W iface,
LPCWSTR
lpszUserName
,
DWORD
dwFlags
)
{
JoystickGenericImpl
*
This
=
impl_from_IDirectInputDevice8W
(
iface
);
int
i
,
j
,
has_actions
=
0
;
DWORD
object_types
[]
=
{
DIDFT_AXIS
,
DIDFT_BUTTON
};
DWORD
type_map
[]
=
{
DIDFT_RELAXIS
,
DIDFT_PSHBUTTON
};
FIXME
(
"(%p)->(%p,%s,%08x): semi-stub !
\n
"
,
iface
,
lpdiaf
,
debugstr_w
(
lpszUserName
),
dwFlags
);
return
DI_NOEFFECT
;
for
(
i
=
0
;
i
<
lpdiaf
->
dwNumActions
;
i
++
)
{
DWORD
inst
=
(
0x000000ff
&
(
lpdiaf
->
rgoAction
[
i
].
dwSemantic
))
-
1
;
DWORD
type
=
0x000000ff
&
(
lpdiaf
->
rgoAction
[
i
].
dwSemantic
>>
8
);
DWORD
genre
=
0xff000000
&
lpdiaf
->
rgoAction
[
i
].
dwSemantic
;
/* Only consider actions of the right genre */
if
(
lpdiaf
->
dwGenre
!=
genre
&&
genre
!=
DIGENRE_ANY
)
continue
;
for
(
j
=
0
;
j
<
sizeof
(
object_types
)
/
sizeof
(
object_types
[
0
]);
j
++
)
{
if
(
type
&
object_types
[
j
])
{
/* Assure that the object exists */
LPDIOBJECTDATAFORMAT
odf
=
dataformat_to_odf_by_type
(
This
->
base
.
data_format
.
wine_df
,
inst
,
DIDFT_BUTTON
);
if
(
odf
!=
NULL
)
{
lpdiaf
->
rgoAction
[
i
].
dwObjID
=
type_map
[
j
]
|
(
0x0000ff00
&
(
inst
<<
8
));
lpdiaf
->
rgoAction
[
i
].
guidInstance
=
This
->
base
.
guid
;
lpdiaf
->
rgoAction
[
i
].
dwHow
=
DIAH_DEFAULT
;
has_actions
=
1
;
/* No need to try other types if the action was already mapped */
break
;
}
}
}
}
if
(
!
has_actions
)
return
DI_NOEFFECT
;
return
IDirectInputDevice8WImpl_BuildActionMap
(
iface
,
lpdiaf
,
lpszUserName
,
dwFlags
);
}
HRESULT
WINAPI
JoystickAGenericImpl_BuildActionMap
(
LPDIRECTINPUTDEVICE8A
iface
,
...
...
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