Re: [hatari-devel] joystick subsystem patch for configurable axis mapping

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Am Dienstag, den 13.12.2011, 17:55 +0100 schrieb Nicolas Pomarède: 
> Le 13/12/2011 17:47, Matthias Arndt a écrit :
> 
> Hello,
> 
> you do :
> 
> +                if(strncmp(thismapping->SDLJoystickName, 
> SDL_JoystickName(i),strlen(thismapping->SDLJoystickName)) == 0)
> 
> this means that if SDL reports "USB Gamepad xyz" or "USB Gamepad 123" it 
> will match with your table "USB Gamepad".
> 
> Is this the expected behaviour (substring matching) ? Or would it be 
> better to use strcmp to get exact matching ?  (I don't know, I don't 
> have any joystick)

For the time being yes, it is. The problem is that the SDL reported
names seem to be padded at times. Basically having a proper USB ID
mapping would be what is needed but SDL (ofcourse) is abstracted from
the hardware. I also don't want to add too much dynamic memory
management as of yet, just to fit the length of the strings.

I can try to make that name a lot more more explicit.

As stated, this is a temporary solution with the intend to have this
data read and stored into the configuration file.

BTW if you don't have a joystick/pad yet, cheap USB ones cost 7 to 10€.
Great to test, esp as such a cheap one caused the trouble here.

Regards,
Matthias
-- 
Matthias Arndt <marndt@xxxxxxxxxxxxxx>
PGP-Key: http://www.final-memory.org/files/marndt.asc
Jabber: simonsunnyboy@xxxxxxxxxxxxxxxx




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/