mirror of https://github.com/libsdl-org/SDL.git
audio/video: Skip preferred drivers when loading a driver on demand
Preferred driver entries have special conditions for initializing, which aren't relevant when a specific driver was explicitly requested.
This commit is contained in:
parent
715c18739b
commit
706de78a9e
|
|
@ -964,7 +964,7 @@ bool SDL_InitAudio(const char *driver_name)
|
|||
}
|
||||
|
||||
for (int i = 0; bootstrap[i]; ++i) {
|
||||
if (SDL_strcasecmp(bootstrap[i]->name, driver_attempt) == 0) {
|
||||
if (!bootstrap[i]->is_preferred && SDL_strcasecmp(bootstrap[i]->name, driver_attempt) == 0) {
|
||||
tried_to_init = true;
|
||||
SDL_zero(current_audio);
|
||||
current_audio.pending_events_tail = ¤t_audio.pending_events;
|
||||
|
|
|
|||
|
|
@ -360,6 +360,7 @@ typedef struct AudioBootStrap
|
|||
const char *desc;
|
||||
bool (*init)(SDL_AudioDriverImpl *impl);
|
||||
bool demand_only; // if true: request explicitly, or it won't be available.
|
||||
bool is_preferred;
|
||||
} AudioBootStrap;
|
||||
|
||||
// Not all of these are available in a given build. Use #ifdefs, etc.
|
||||
|
|
|
|||
|
|
@ -1337,7 +1337,7 @@ static bool PIPEWIRE_Init(SDL_AudioDriverImpl *impl)
|
|||
}
|
||||
|
||||
AudioBootStrap PIPEWIRE_PREFERRED_bootstrap = {
|
||||
"pipewire", "Pipewire", PIPEWIRE_PREFERRED_Init, false
|
||||
"pipewire", "Pipewire", PIPEWIRE_PREFERRED_Init, false, true
|
||||
};
|
||||
AudioBootStrap PIPEWIRE_bootstrap = {
|
||||
"pipewire", "Pipewire", PIPEWIRE_Init, false
|
||||
|
|
|
|||
|
|
@ -504,6 +504,7 @@ typedef struct VideoBootStrap
|
|||
const char *desc;
|
||||
SDL_VideoDevice *(*create)(void);
|
||||
bool (*ShowMessageBox)(const SDL_MessageBoxData *messageboxdata, int *buttonID); // can be done without initializing backend!
|
||||
bool is_preferred;
|
||||
} VideoBootStrap;
|
||||
|
||||
// Not all of these are available in a given build. Use #ifdefs, etc.
|
||||
|
|
|
|||
|
|
@ -654,7 +654,8 @@ bool SDL_VideoInit(const char *driver_name)
|
|||
: SDL_strlen(driver_attempt);
|
||||
|
||||
for (i = 0; bootstrap[i]; ++i) {
|
||||
if ((driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
||||
if (!bootstrap[i]->is_preferred &&
|
||||
(driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
||||
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
|
||||
video = bootstrap[i]->create();
|
||||
if (video) {
|
||||
|
|
|
|||
|
|
@ -685,7 +685,8 @@ static SDL_VideoDevice *Wayland_Fallback_CreateDevice(void)
|
|||
VideoBootStrap Wayland_preferred_bootstrap = {
|
||||
WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver",
|
||||
Wayland_Preferred_CreateDevice,
|
||||
Wayland_ShowMessageBox
|
||||
Wayland_ShowMessageBox,
|
||||
true
|
||||
};
|
||||
|
||||
VideoBootStrap Wayland_bootstrap = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue