dinput, wheel/joystick and richard burns rally

Tuomo Kohvakka jesh at iki.fi
Sun Jan 7 14:22:34 CST 2007


first, appdb entry:


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 
   * instance id.
((asked_format->rgodf[j].dwType & DIDFT_INSTANCEMASK) == 

(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) == 

Now, adding

|| ((asked_format->rgodf[j].dwType&0xff) == (format->wine_df->rgodf[i]. 

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 

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 

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