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
5347ab42
Commit
5347ab42
authored
Aug 15, 2009
by
Vitaliy Margolen
Committed by
Alexandre Julliard
Aug 19, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dinput: Move axes mapping array and default dead-zone into generic joystick class.
parent
2c85da06
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
19 deletions
+20
-19
joystick_linux.c
dlls/dinput/joystick_linux.c
+17
-19
joystick_private.h
dlls/dinput/joystick_private.h
+3
-0
No files found.
dlls/dinput/joystick_linux.c
View file @
5347ab42
...
...
@@ -87,8 +87,6 @@ struct JoystickImpl
/* joystick private */
int
joyfd
;
LONG
deadzone
;
int
*
axis_map
;
int
axes
;
POINTL
povs
[
4
];
};
...
...
@@ -257,12 +255,12 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
/* get options */
if
(
!
get_config_key
(
hkey
,
appkey
,
"DefaultDeadZone"
,
buffer
,
MAX_PATH
))
{
device
->
deadzone
=
atoi
(
buffer
);
TRACE
(
"setting default deadzone to:
\"
%s
\"
%d
\n
"
,
buffer
,
device
->
deadzone
);
device
->
generic
.
deadzone
=
atoi
(
buffer
);
TRACE
(
"setting default deadzone to:
\"
%s
\"
%d
\n
"
,
buffer
,
device
->
generic
.
deadzone
);
}
device
->
axis_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
axes
*
sizeof
(
int
));
if
(
!
device
->
axis_map
)
return
DIERR_OUTOFMEMORY
;
device
->
generic
.
axis_map
=
HeapAlloc
(
GetProcessHeap
(),
0
,
device
->
axes
*
sizeof
(
int
));
if
(
!
device
->
generic
.
axis_map
)
return
DIERR_OUTOFMEMORY
;
if
(
!
get_config_key
(
hkey
,
appkey
,
device
->
generic
.
name
,
buffer
,
MAX_PATH
))
{
static
const
char
*
axis_names
[]
=
{
"X"
,
"Y"
,
"Z"
,
"Rx"
,
"Ry"
,
"Rz"
,
...
...
@@ -289,7 +287,7 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
else
{
/* Pov takes two axes */
device
->
axis_map
[
tokens
++
]
=
i
;
device
->
generic
.
axis_map
[
tokens
++
]
=
i
;
pov
++
;
}
}
...
...
@@ -312,14 +310,14 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
i
=
-
1
;
}
device
->
axis_map
[
tokens
]
=
i
;
device
->
generic
.
axis_map
[
tokens
]
=
i
;
tokens
++
;
}
while
((
ptr
=
strtok
(
NULL
,
delim
))
!=
NULL
);
if
(
tokens
!=
device
->
axes
)
{
ERR
(
"not all joystick axes mapped: %d axes(%d,%d), %d arguments
\n
"
,
device
->
axes
,
axis
,
pov
,
tokens
);
while
(
tokens
<
device
->
axes
)
{
device
->
axis_map
[
tokens
]
=
-
1
;
device
->
generic
.
axis_map
[
tokens
]
=
-
1
;
tokens
++
;
}
}
...
...
@@ -330,14 +328,14 @@ static HRESULT setup_dinput_options(JoystickImpl * device)
for
(
tokens
=
0
;
tokens
<
device
->
axes
;
tokens
++
)
{
if
(
tokens
<
8
)
device
->
axis_map
[
tokens
]
=
axis
++
;
device
->
generic
.
axis_map
[
tokens
]
=
axis
++
;
else
if
(
tokens
<
16
)
{
device
->
axis_map
[
tokens
++
]
=
8
+
pov
;
device
->
axis_map
[
tokens
]
=
8
+
pov
++
;
device
->
generic
.
axis_map
[
tokens
++
]
=
8
+
pov
;
device
->
generic
.
axis_map
[
tokens
]
=
8
+
pov
++
;
}
else
device
->
axis_map
[
tokens
]
=
-
1
;
device
->
generic
.
axis_map
[
tokens
]
=
-
1
;
}
}
device
->
generic
.
devcaps
.
dwAxes
=
axis
;
...
...
@@ -425,7 +423,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
generic
.
base
.
crit
.
DebugInfo
->
Spare
[
0
]
=
(
DWORD_PTR
)(
__FILE__
": JoystickImpl*->generic.base.crit"
);
/* setup_dinput_options may change these */
newDevice
->
deadzone
=
0
;
newDevice
->
generic
.
deadzone
=
0
;
/* do any user specified configuration */
hr
=
setup_dinput_options
(
newDevice
);
...
...
@@ -441,7 +439,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
for
(
i
=
0
;
i
<
newDevice
->
axes
;
i
++
)
{
int
wine_obj
=
newDevice
->
axis_map
[
i
];
int
wine_obj
=
newDevice
->
generic
.
axis_map
[
i
];
if
(
wine_obj
<
0
)
continue
;
...
...
@@ -468,7 +466,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
newDevice
->
generic
.
props
[
i
].
lDevMax
=
+
32767
;
newDevice
->
generic
.
props
[
i
].
lMin
=
0
;
newDevice
->
generic
.
props
[
i
].
lMax
=
0xffff
;
newDevice
->
generic
.
props
[
i
].
lDeadZone
=
newDevice
->
deadzone
;
/* % * 1000 */
newDevice
->
generic
.
props
[
i
].
lDeadZone
=
newDevice
->
generic
.
deadzone
;
/* % * 1000 */
newDevice
->
generic
.
props
[
i
].
lSaturation
=
0
;
}
...
...
@@ -489,7 +487,7 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
if
(
TRACE_ON
(
dinput
))
{
_dump_DIDATAFORMAT
(
newDevice
->
generic
.
base
.
data_format
.
wine_df
);
for
(
i
=
0
;
i
<
(
newDevice
->
axes
);
i
++
)
TRACE
(
"axis_map[%d] = %d
\n
"
,
i
,
newDevice
->
axis_map
[
i
]);
TRACE
(
"axis_map[%d] = %d
\n
"
,
i
,
newDevice
->
generic
.
axis_map
[
i
]);
_dump_DIDEVCAPS
(
&
newDevice
->
generic
.
devcaps
);
}
...
...
@@ -503,7 +501,7 @@ FAILED1:
if
(
df
)
HeapFree
(
GetProcessHeap
(),
0
,
df
->
rgodf
);
HeapFree
(
GetProcessHeap
(),
0
,
df
);
release_DataFormat
(
&
newDevice
->
generic
.
base
.
data_format
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
axis_map
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
generic
.
axis_map
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
->
generic
.
name
);
HeapFree
(
GetProcessHeap
(),
0
,
newDevice
);
*
pdev
=
0
;
...
...
@@ -684,7 +682,7 @@ static void joy_polldev(JoystickGenericImpl *This_in) {
}
else
if
(
jse
.
type
&
JS_EVENT_AXIS
)
{
int
number
=
This
->
axis_map
[
jse
.
number
];
/* wine format object index */
int
number
=
This
->
generic
.
axis_map
[
jse
.
number
];
/* wine format object index */
if
(
number
<
0
)
return
;
inst_id
=
DIDFT_MAKEINSTANCE
(
number
)
|
(
number
<
8
?
DIDFT_ABSAXIS
:
DIDFT_POV
);
...
...
dlls/dinput/joystick_private.h
View file @
5347ab42
...
...
@@ -46,6 +46,9 @@ typedef struct JoystickGenericImpl
GUID
guidInstance
;
char
*
name
;
int
*
axis_map
;
/* User axes remapping */
LONG
deadzone
;
/* Default dead-zone */
joy_polldev_handler
*
joy_polldev
;
}
JoystickGenericImpl
;
...
...
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