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
736d03c8
Commit
736d03c8
authored
Apr 27, 2008
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Apr 28, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Fix default axes mapping generation.
parent
67a7a8a8
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
joystick_linux.c
dlls/dinput/joystick_linux.c
+21
-21
No files found.
dlls/dinput/joystick_linux.c
View file @
736d03c8
...
@@ -271,6 +271,9 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
...
@@ -271,6 +271,9 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
{
{
char
buffer
[
MAX_PATH
+
16
];
char
buffer
[
MAX_PATH
+
16
];
HKEY
hkey
,
appkey
;
HKEY
hkey
,
appkey
;
int
tokens
=
0
;
int
axis
=
0
;
int
pov
=
0
;
buffer
[
MAX_PATH
]
=
'\0'
;
buffer
[
MAX_PATH
]
=
'\0'
;
...
@@ -283,18 +286,14 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
...
@@ -283,18 +286,14 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
TRACE
(
"setting default deadzone to:
\"
%s
\"
%d
\n
"
,
buffer
,
device
->
deadzone
);
TRACE
(
"setting default deadzone to:
\"
%s
\"
%d
\n
"
,
buffer
,
device
->
deadzone
);
}
}
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
->
name
,
buffer
,
MAX_PATH
))
{
int
tokens
=
0
;
int
axis
=
0
;
int
pov
=
0
;
const
char
*
delim
=
","
;
const
char
*
delim
=
","
;
char
*
ptr
;
char
*
ptr
;
TRACE
(
"
\"
%s
\"
=
\"
%s
\"\n
"
,
device
->
name
,
buffer
);
TRACE
(
"
\"
%s
\"
=
\"
%s
\"\n
"
,
device
->
name
,
buffer
);
device
->
axis_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
axes
*
sizeof
(
int
));
if
(
device
->
axis_map
==
0
)
return
DIERR_OUTOFMEMORY
;
if
((
ptr
=
strtok
(
buffer
,
delim
))
!=
NULL
)
{
if
((
ptr
=
strtok
(
buffer
,
delim
))
!=
NULL
)
{
do
{
do
{
if
(
strcmp
(
ptr
,
"X"
)
==
0
)
{
if
(
strcmp
(
ptr
,
"X"
)
==
0
)
{
...
@@ -355,9 +354,22 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
...
@@ -355,9 +354,22 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
}
}
}
}
}
else
{
for
(
tokens
=
0
;
tokens
<
device
->
axes
;
tokens
++
)
{
if
(
tokens
<
8
)
device
->
axis_map
[
tokens
]
=
axis
++
;
else
{
device
->
axis_map
[
tokens
]
=
8
+
pov
;
device
->
axis_map
[
tokens
++
]
=
8
+
pov
++
;
}
}
}
device
->
devcaps
.
dwAxes
=
axis
;
device
->
devcaps
.
dwAxes
=
axis
;
device
->
devcaps
.
dwPOVs
=
pov
;
device
->
devcaps
.
dwPOVs
=
pov
;
}
if
(
appkey
)
if
(
appkey
)
RegCloseKey
(
appkey
);
RegCloseKey
(
appkey
);
...
@@ -445,29 +457,17 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
...
@@ -445,29 +457,17 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
/* setup_dinput_options may change these */
/* setup_dinput_options may change these */
newDevice
->
deadzone
=
0
;
newDevice
->
deadzone
=
0
;
newDevice
->
devcaps
.
dwButtons
=
newDevice
->
buttons
;
newDevice
->
devcaps
.
dwButtons
=
newDevice
->
buttons
;
newDevice
->
devcaps
.
dwAxes
=
newDevice
->
axes
;
newDevice
->
devcaps
.
dwPOVs
=
0
;
/* do any user specified configuration */
/* do any user specified configuration */
hr
=
setup_dinput_options
(
newDevice
);
hr
=
setup_dinput_options
(
newDevice
);
if
(
hr
!=
DI_OK
)
if
(
hr
!=
DI_OK
)
goto
FAILED1
;
goto
FAILED1
;
if
(
newDevice
->
axis_map
==
0
)
{
newDevice
->
axis_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
newDevice
->
axes
*
sizeof
(
int
));
if
(
newDevice
->
axis_map
==
0
)
goto
FAILED
;
for
(
i
=
0
;
i
<
newDevice
->
axes
;
i
++
)
newDevice
->
axis_map
[
i
]
=
i
;
}
/* Create copy of default data format */
/* Create copy of default data format */
if
(
!
(
df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
c_dfDIJoystick2
.
dwSize
)))
goto
FAILED
;
if
(
!
(
df
=
HeapAlloc
(
GetProcessHeap
(),
0
,
c_dfDIJoystick2
.
dwSize
)))
goto
FAILED
;
memcpy
(
df
,
&
c_dfDIJoystick2
,
c_dfDIJoystick2
.
dwSize
);
memcpy
(
df
,
&
c_dfDIJoystick2
,
c_dfDIJoystick2
.
dwSize
);
/* Axes include POVs */
df
->
dwNumObjs
=
newDevice
->
devcaps
.
dwAxes
+
newDevice
->
devcaps
.
dwPOVs
+
newDevice
->
buttons
;
df
->
dwNumObjs
=
newDevice
->
axes
+
newDevice
->
buttons
;
if
(
!
(
df
->
rgodf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
df
->
dwNumObjs
*
df
->
dwObjSize
)))
goto
FAILED
;
if
(
!
(
df
->
rgodf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
df
->
dwNumObjs
*
df
->
dwObjSize
)))
goto
FAILED
;
for
(
i
=
0
;
i
<
newDevice
->
axes
;
i
++
)
for
(
i
=
0
;
i
<
newDevice
->
axes
;
i
++
)
...
...
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