Re: SDL_Controller design

Ed Phillips <[email protected]> Mon, 19 Dec 2016 13:15:17 -0500 (EST)
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
Hi Alex,

On Mon, 19 Dec 2016, Alex Szpakowski wrote:

> I don’t believe the XInput API gives that information.
>
>> On Dec 19, 2016, at 1:18 PM, Ed Phillips <[email protected]> wrote:
>>
>> There needs to be a way to tell the "type" of device, but also which 
>> plugged-in-device is which (existing "XInput Controller #2" scheme vs. 
>> something identifiable to the user like "Logitech F310 Gamepad in 
>> XINPUT mode”).

I agree and that's unfortunate.  <rant> It's just another indication that 
Microsoft made XINPUT specifically for their own devices, then decided to 
"abandon" DINPUT, which forced everyone else to either dumb down their 
controllers to be like an Xpad, or support the legacy DINPUT way instead 
(steering wheels and flight controllers and trackballs and such) and thus 
be "incompatible" with all the games that only support XINPUT.  It boils 
down to, unless your game is suited for Xpad-style gameplay, you're going 
to need DINPUT device support. </rant>

Thanks goodness for SDL!

Side note: It really is the "dark ages" of game controllers these days... 
isn't it?  Remember when you could walk into a store and buy one of dozens 
of different game controllers that all just worked with your games?

Anyway... so in order to differentiate between different XINPUT devices, 
we'd need to key off of the Vendor/Product IDs, and the data that is 
available for the product names of these devices like "usb.ids" here:

https://usb-ids.gowdy.us/

That could work.

Really, we need some kind of controller identifier (product name, or 
unique ID or something similar) to avoid situations like the following:

Perhaps your XBox-compatible gamepad has buttons instead of analog LT/RT 
so you want to map them differently in your game - for example, 
brake/throttle for a racing game.  Putting the pedal to the metal every 
time you want to accelerate may not work very well (burn outs, spin outs). 
It would be useful for the player to be able to remap this function for 
this particular controller, but not his real Xpad.  If it's a head-to-head 
game, one person remaps all the controls for everyone playing?  You could 
get around this by prompting each player to press a button on their 
controller before configuring but then how do we save the mapping so they 
don't have to redo it every game session?  Maybe XINPUT guarantees that if 
the controllers stay plugged into the same ports, even if they fall 
asleep, they won't get renumbered, so controller #2's config could be 
saved (LT/RT remapping) and auto-applied next game session?

Thanks,

 	Ed

Ed Phillips <[email protected]> University of Delaware (302) 831-6082
Systems Programmer IV, Network and Systems Services

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org