We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4854 - Add a way to extend the values in controller_type.h
Summary: Add a way to extend the values in controller_type.h
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: joystick (show other bugs)
Version: 2.0.10
Hardware: All All
: P2 enhancement
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2019-11-05 20:05 UTC by Sam Lantinga
Modified: 2020-03-02 18:38 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Lantinga 2019-11-05 20:05:59 UTC
It would be handy to expand the controller list supported by SDL without having to recompile it with additional entries in controller_type.h
Comment 1 Ryan C. Gordon 2019-11-11 20:25:07 UTC
Sam, do you have a plan for this already, or should I tackle it?

(I assume the plan is SDL looks in a few standard places and merges any data found in them: somewhere in the standard Steam Runtime location, /etc/SDL_gamecontrollerdb.txt, $HOME/.SDL_gamecontrollerdb.txt or whatever. Or maybe just an environment variable like SDL_GAEMCONTROLLERDB_FILE that Steam sets?)

--ryan.
Comment 2 Sam Lantinga 2019-11-23 00:28:33 UTC
Probably we'll want a hint for this, e.g. SDL_HINT_CONTROLLER_TYPES, parse it into a list of override entries at startup and again if the hint changes.

I'm not sure about the format of the hint...
Maybe a comma separated list, e.g.
VID/PID=VALUE,VID/PID=VALUE,etc.

The VALUE should probably be parsed both as string ("XBox360", "PS3", etc.) and as numeric value. The numeric value should probably use the new SDL_GameControllerType enumeration values rather than the Valve values in the controller_types.h header.

Thoughts?
Comment 3 Sam Lantinga 2020-03-02 18:38:14 UTC
Implemented!
https://hg.libsdl.org/SDL/rev/9d16201f3a3f