Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining device index vs instance work #22

Open
3 tasks
icculus opened this issue Jan 5, 2023 · 0 comments
Open
3 tasks

Remaining device index vs instance work #22

icculus opened this issue Jan 5, 2023 · 0 comments

Comments

@icculus
Copy link
Collaborator

icculus commented Jan 5, 2023

There are a few places we still need to deal with device indexes that we currently don't:

  • Device add events are meant to supply an index in SDL2; it's an instance in SDL3.
  • JoystickAttachVirtual and JoystickDetachVirtual deal with indices in SDL2.
  • Audio devices need to be tracked in SDL2 now that this has changed in SDL3.

(Eventually we'll be doing the same thing with audio, but we'll deal with that separately, since this hasn't changed in SDL3 yet afaik.)

Right now we are just keeping a list of device instances that only changes when someone calls SDL_NumJoysticks, etc, so the indices are stable, but we'll have to append new items to the end of the list between calls (and check exactly what the behavior on this is in real SDL2 when adding virtual joysticks, etc).

My thinking is that we won't try to adjust the array when a device is removed, so indices stay stable until the next SDL_NumJoysticks call; if an app tries to use that device, it'll correctly fail because the underlying device instance value will be bogus, but nothing will explode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant