dinput: Support INFINITE as number of effect iterations (try 2)

Marcel Hasler mahasler at gmail.com
Sun Jan 29 17:31:57 CST 2012


2012/1/29 Vitaliy Margolen <wine-devel at kievinfo.com>:
> On 01/28/2012 05:56 PM, Marcel Hasler wrote:
>>
>> According to the DirectX reference, IDirectInputEffect::Start accepts
>> INFINITE (aka -1) for the number of iterations. However, passing -1 to
>> Linux via input_event results in no effect being played at all. This
>> patch sets the number of iterations to the maximum signed value
>> allowed if INFINITE is passed.
>>
>> This fixes bug 29712.
>>
>> This patch supersedes patch 83233. It does the same thing but adds a
>> comment and should be easier to understand.
>
>
> In general looks good. Would be nice to point out that linux/input.h says
> that any durations should not exceed 0x7fff as a maximum value.
>
> Please don't make code "easier to read" by adding needless if / else. Your
> first patch was fine.
>
> Vitaliy.

Thanks for your feedback.

I just had another look at linux/input.h and realized I made a
mistake. The member 'value' is actually declared __s32, so it really
should be 0x7fffffff. Is there any predefined constant that could be
used for this, rather than using a literal? This is what the code
looks like at the moment:

/* Linux doesn't accept INFINITE, use the maximum __s32 value instead */
event.value = (dwIterations == INFINITE) ? 0x7fffffff : dwIterations;

The limit 0x7fff mentioned in input.h doesn't concern the number of
iterations, just durations. I couldn't find anything on an upper limit
for 'value'. I've tested 0x7fffffff and it works just fine.

Marcel



More information about the wine-devel mailing list