Hi,
The patch needs a few improvements before it can be accepted into Wine. I can't comment on the dinput / xinput specifics of the patch, so this is a non- exhaustive list of general suggestions.
Concerning the big picture, this patch needs a few discussions about xinput.dll design. There have been some discussions about that in the past, and I hope that some dinput devs can help out.
Am Dienstag, 12. Juni 2012, 23:48:53 schrieb Giovanni Ongaro:
From: root <root@joe.(none)>
Please configure git correctly, see http://wiki.winehq.org/GitWine section 3.3.
Also consider using a non-root user, but that's your personal setup, so not really my business.
if (getenv("LINIXFORCENOJOY") != NULL) return FALSE; /*JoeFix disable
joystick*/ The problem with dinput vs xinput conflicts should probably be solved in a different manner. That aside, such configurations are usually done via registry keys. Also comments like /* I changed this here */ are useless, the git history stores this information anyway.
- <...> //JoeFix DEAD ZONE
This is a C++ comment and not allowed in Wine. See http://wiki.winehq.org/SubmittingPatches
- fdJoy=open("/dev/input/js0",O_RDONLY | O_NONBLOCK);
Xinput.dll should not open joystick devices directy, and definitely not a hardcoded one. I don't know if there's consensus about how xinput should be implemented, but basing it on top of dinput might be a start.
A good start would be to write a few tests to test how Windows announces(or doesn't announce) Xbox gamepads and other gamepads/joysticks to games. My understanding is that xinput.dll only works for Xbox gamepads. Do those show up in dinput on Windows?
+#define DEAD_ZONE 4096 ...
if (e.number == 4) {
if (e.value == 1) {
FIXME("TRIGGER LEFT PRESSED\n");
pState->Gamepad.bLeftTrigger=32767;
}
else {
pState->Gamepad.bLeftTrigger=0;
}
... +#define JOYMAX 30000 +#define JOYMIN -30000
The hardcoded numbers look questionable. The 4 and 1 are probably specific to the joystick, the 32767 might have a symbolic name like XINPUT_MAX or something.
A part of this seems to be needed due to the attempt to emulate an xbox gamepad with a different device. Personally I'm not opposed to doing that, and you might need some device specific tricks to pull this off. However, this needs a more structured approach than hardcoding the values needed for one specific Logitech device in the code.
Best regards, Stefan