Re: [AD] Hotplug joysticks

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2010-08-18, Trent Gamblin <trent@xxxxxxxxxx> wrote:
> I've got joystick hotplugging working on Windows right now.
> This is one feature that maybe should be added to 4.9 now
> because it changes the semantics of how things work a bit.
> This is how it works:
> 
> The user installs joystick driver and calls al_get_num_joysticks and al_get_joystick(x).
> Everything behaves as normal until:
> The (new) system event source (al_get_system_event_source) emits a ALLEGRO_EVENT_JOYSTICK_CONFIGURED event.

I would prefer a dedicated joystick subsystem event source.  Actually,
we don't *need* a separate joystick event source per joystick, so maybe
we should use a single joystick event source for all joysticks.
In fact, the user doesn't need to see ALLEGRO_JOYSTICK objects at all:
just use the joystick number.  In many ways this would be more convenient.

> At this point, the user can ignore the event and proceed as
> normal, but if they call al_get_num_joysticks, the present "user" configuration of sticks changed to the present "system" view of joysticks (what is actually plugged in and not on the system at that time.)
> User calls al_get_joystick(x) again for all desired joysticks.

How about adding al_reinstall_joystick(), or al_reconfigure_joysticks()?
It would then be obvious that from that point, al_get_num_joysticks may
change, all old joystick structures become invalid (if that's what we
want), and they need to be reregistered (unless we switch to a single
joystick event source).

Peter




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