dinput - Allow the use of the standard Joystick GUID when calling CreateDevice

Vitaliy Margolen wine-devel at kievinfo.com
Tue Jul 31 07:34:24 CDT 2007


Peter Dons Tychsen wrote:
> On Mon, 2007-07-30 at 21:20 +0200, Peter Dons Tychsen wrote:
>> On Sun, 2007-07-29 at 17:43 -0600, Vitaliy Margolen wrote:
>>> Peter Dons Tychsen wrote:
>>>> OK. Please review this diff:
>>>>
>>>> I will re-submit it if you like it.
>>>>
>>>> /Pedro
>>> Alright looks good now (you might want to remove the extra white space your 
>>> patch adds - git complains about those). Just left to make the same change 
>>> to the other joystick interface :)
>>>
>>> BTW don't forget to cc: the wine-devel list when you replying.
>>>
>>> Vitaliy.
>> OK. I still feel that trying to sync joystick_linuxinput.c and
>> joystick_linux.c is out of scope for this patch. But as my steadiness
>> has limits i have done some of it anyway... :). I have kept the changes
>> modest.
>>
>> Please take a look at the new patch.
>>
>> On another note i will agree with you that it would be practical if the
>> two files had similar (or maybe even shared) code. Redundant code is
>> never very practical as it always ends up as this very example. The two
>> implementations which were supposed to identical always drift apart. If
>> things are supposed to do the same, keep them together to begin with.
>>
>> Thanks,
>>
> Maybe i would be more successful if i actually attached the
> patch.... :-)
> 
> Here it is....

Just few small things left:

> -#undef MAX_JOYSTICKS
As I mentioned earlier you should move this instead of removing it completely.


>  static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev)
>  {
> -  int i;
> -
> -  find_joydevs();
You removed a really important function call here.


> +static HRESULT joydev_create_deviceA(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev)
> +{
> +  unsigned short index;
> +
> +  if ((index = get_joystick_index(rguid)) < MAX_JOYDEV) {
> +    if ((riid == NULL) ||
If you reformat the whole function, please make it 4-space indented.

Vitaliy.



More information about the wine-devel mailing list