mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-25 09:17:12 +01:00
Support comma-separated lists in SDL_VIDEODRIVER
This commit is contained in:
parent
ba8bc143c1
commit
5ec69285fa
@ -498,12 +498,21 @@ SDL_VideoInit(const char *driver_name)
|
|||||||
driver_name = SDL_getenv("SDL_VIDEODRIVER");
|
driver_name = SDL_getenv("SDL_VIDEODRIVER");
|
||||||
}
|
}
|
||||||
if (driver_name != NULL) {
|
if (driver_name != NULL) {
|
||||||
|
const char *driver_attempt = driver_name;
|
||||||
|
while(driver_attempt != NULL && *driver_attempt != 0 && video == NULL) {
|
||||||
|
const char* driver_attempt_end = SDL_strchr(driver_attempt, ',');
|
||||||
|
size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt)
|
||||||
|
: SDL_strlen(driver_attempt);
|
||||||
|
|
||||||
for (i = 0; bootstrap[i]; ++i) {
|
for (i = 0; bootstrap[i]; ++i) {
|
||||||
if (SDL_strncasecmp(bootstrap[i]->name, driver_name, SDL_strlen(driver_name)) == 0) {
|
if (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0) {
|
||||||
video = bootstrap[i]->create(index);
|
video = bootstrap[i]->create(index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
driver_attempt = (driver_attempt_end != NULL) ? (driver_attempt_end + 1) : NULL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; bootstrap[i]; ++i) {
|
for (i = 0; bootstrap[i]; ++i) {
|
||||||
video = bootstrap[i]->create(index);
|
video = bootstrap[i]->create(index);
|
||||||
|
Loading…
Reference in New Issue
Block a user