Release game controller device correctly. #568
A followup on 02520fb6
.
In wxSDLJoy::Remove(n), which is the only API that needs to release a
game controller device from the application, actually call
SDL_GameControllerClose(dev) when a device is released.
This is used when the input config dialog is launched. First all sticks
are closed, and then all available sticks are added for the duration of
the dialog. Then they are closed again, and only the configured sticks
are open for the game, which is what happens generally.
The device ordering is determined by the OS.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
85abf97a21
commit
e04efa76b3
|
@ -147,10 +147,19 @@ void wxSDLJoy::Remove(int8_t joy_n)
|
|||
add_all = false;
|
||||
|
||||
if (joy_n < 0) {
|
||||
for (auto joy : joystate) {
|
||||
if (auto dev = std::get<1>(joy).dev)
|
||||
SDL_GameControllerClose(dev);
|
||||
}
|
||||
|
||||
joystate.clear();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto dev = joystate[joy_n].dev)
|
||||
SDL_GameControllerClose(dev);
|
||||
|
||||
joystate.erase(joy_n);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue