dinput, wheel/joystick and richard burns rally
Tuomo Kohvakka
jesh at iki.fi
Sun Jan 7 14:22:34 CST 2007
Hello,
first, appdb entry:
http://appdb.winehq.org/appview.php?iVersionId=5934&iTestingId=6382
As shown there, joystick (that ofcourse really means the wheel :) isn't
detected by the game with current wine. I decided to take a look at
that, figuring that it might be fixable.
Well, I managed to "fix" it. Code follows, dlls/dinput/device.c,
create_DataFormat() around line 387 says that
&&
(/* Then check if it accepts any instance id, and if not, if it matches
Wine's
* instance id.
*/
((asked_format->rgodf[j].dwType & DIDFT_INSTANCEMASK) ==
DIDFT_ANYINSTANCE) ||
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0x00FF) || /*
This is mentionned in no DX docs, but it works fine - tested on WinXP */
(DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) ==
DIDFT_GETINSTANCE(format->wine_df->rgodf[i].dwType)))
&&
Now, adding
|| ((asked_format->rgodf[j].dwType&0xff) == (format->wine_df->rgodf[i].
=>dwType&0xff))
into middle of that fixes it. It works fine and doesn't seem to break
anything (didn't try other applications thought).
It took me a couple of hours to figure above ou, a few more comments
more might have helped! :) (code itself is rather easy to follow)
Now, my problem is that I don't really know anything about directx or
much about windows anyhow. That means that I don't know if above "fix"
is really proper way to fix anything. I figure that purpose of this
function make a mapping from devices axes and buttons (wine
datastructure) into applications preferred structure (which is used
later on in fill_DataFormat). Mapping goes wrong without above, as
application requests "3" in dwType and wine has something like
0x80ffff03. It's defined in c_dfDIJoystick2, data_formats.c as
DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE.
If mapping goes wrong offset_in becomes -1 and that means that default
values will be used (button not pressed etc). (If I would submit a patch
containing only comments, some probably wrong guesses, would it be
accepted?)
Someone here on list probably has more insight on this. What is that
dwType anyways? :) Is above fix correct, or should dwType be something
else from the beginning with, or am I just completely lost?
Bottom line ofcourse is that I would like to see a proper fix in wine
.29 that would allow rbr and wheel co-operate :) Should I just try to
submit this as a patch?
--
Tuomo Kohvakka
More information about the wine-devel
mailing list