[Wine] Xbox 360 controller, xinput9_1_0 and Overlord
jkohen at users.sourceforge.net
Tue Nov 24 18:24:49 CST 2009
Vincent & list,
On Tue, Nov 24, 2009 at 05:26, Vincent Povirk
<madewokherd+8cd9 at gmail.com> wrote:
> I don't have an Xbox 360 controller myself, so I haven't looked at
> this in much detail.
> Microsoft has a reference for xinput at
> http://msdn.microsoft.com/en-us/library/ee416996(VS.85).aspx. From
> what I can remember, the API itself is very simple and shouldn't
> require a detailed understanding of other parts of Wine.
> The generic joystick support is in dinput. According to
> http://msdn.microsoft.com/en-us/library/ee417014(VS.85).aspx, dinput
> doesn't support some features that are in xinput. Since we don't like
> to add new features to a windows dll, I don't think xinput should use
> dinput. Also, I worry that you might not get a consistent button
> mapping between operating systems, and that you may need to use some
> more direct interface to be sure you get it right. But I could be
> As far as I know, no one is working on this, so by all means go for it.
Thanks for the tips. After a closer inspection it seems I was wrong,
and actually the IDirectInput implementation needs to be extended.
Namely EnumDevicesBySemantics and SetActionMap. See below for details.
With some initial difficulty I hacked together an implementation of
EnumDevicesBySemantics that passes the first joystick (first device in
the GAMECTRL category, as a test) and now the game is moving forward
with a calls to IDirectInput::SetActionMap on those devices. After
that the game is playable, but unfortunately there is no joystick
support, yet. The input loop polls all devices ad infinitum with
IDirectInputDevice::GetDeviceData. So every two messages listing the
length of the keyboard and mouse event, there is a copy of the
trace:dinput:_dump_cooperativelevel_DI cooperative level :
trace:dinput:IDirectInputDevice2AImpl_Acquire no user data format
warn:dinput:JoystickAImpl_Acquire Failed to acquire: 80070057
According to Wine's code and to the MSDN, Acquire cannot succeed
without a call to SetActionMap or SetDataFormat. The latter is
implemented, but is only used for setting up the mouse and the
keyboard; the former is an empty stub, which means the setup required
by Acquire never happens.
Has anybody looked into a proper implementation of
EnumDevicesBySemantics and SetActionMap? Both seem to rely in the
"action mapping constants," which at first look seem kinda scary. I
know little to nothing about DInput, but for mice and keyboards the
initialization seems over after SetDataFormat, so I expect
SetActionMap is the last step for joysticks and game pads (there are a
couple extra calls common to all devices which seem fully
More information about the wine-users