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?
On Sun, Jan 07, 2007 at 10:22:34PM +0200, Tuomo Kohvakka wrote:
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.
the problem here is somehow deeper within wine. we store a dataformat as default with the device, that does not represent the informations sent to the app. so when an app want to build its own data-format using the infos there.
so the problem was actually fixed some time ago but the fix got lost with a huge clean up session. so there is actually currently work undergoing, that fixes the problem (see the mails about RBR before the holidays).
&& (/* 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 */
imho this already does not make sense..
(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))
... but then adding the next "magic" check is wrong. but this is a gut-feeling and maybe there are already new problems introduced with the recent patches. for my part i can at least say, that everythings is working in WINE's head trunk - except RBR with the same problem as before xmas.
for what i have seen Vitaliy has build the ground to finally make the same patches for the joysticks as for keyboard and mouse?
Christoph Frick wrote:
On Sun, Jan 07, 2007 at 10:22:34PM +0200, Tuomo Kohvakka wrote:
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.
the problem here is somehow deeper within wine. we store a dataformat as default with the device, that does not represent the informations sent to the app. so when an app want to build its own data-format using the infos there.
so the problem was actually fixed some time ago but the fix got lost with a huge clean up session. so there is actually currently work undergoing, that fixes the problem (see the mails about RBR before the holidays).
That is correct. I already fixed mouse and keyboard the proper way. Now left to fix joysticks. It seems joysticks are in the worse shape that I thought. Number of places using wrong object indexes.
Now, adding
|| ((asked_format->rgodf[j].dwType&0xff) == (format->wine_df->rgodf[i]. =>dwType&0xff))
Yeah this is wrong. You left only object type and got rid of everything else, including instance.
Vitaliy.