X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=sdl_omap.git;a=blobdiff_plain;f=src%2Fvideo%2Fomapdss%2Fconfig.c;h=865b80ad4094848955f5f378bf85cac8beb50d29;hp=e526c363d4a650aacf21ef90562ca01e94a8183d;hb=0aab059fdffebbbf5af73cc7549adaf58470d0ec;hpb=b78828bf6c654f3763394f153d31bab3fc5c8a64 diff --git a/src/video/omapdss/config.c b/src/video/omapdss/config.c index e526c36..865b80a 100644 --- a/src/video/omapdss/config.c +++ b/src/video/omapdss/config.c @@ -6,12 +6,15 @@ */ #include +#include #include #include #include #include "omapsdl.h" +int gcfg_force_vsync; + static char *sskip(char *p) { while (*p && isspace(*p)) @@ -26,10 +29,26 @@ static char *nsskip(char *p) return p; } -static int check_token(const char *p, const char *token) +static int check_token(char **p_, const char *token) { + char *p = *p_; int tlen = strlen(token); - return strncasecmp(p, token, tlen) == 0 && isspace(p[tlen]); + int ret = strncasecmp(p, token, tlen) == 0 && isspace(p[tlen]); + if (ret) + *p_ = sskip(p + tlen + 1); + + return ret; +} + +static int check_token_eq(char **p_, const char *token) +{ + char *p = *p_; + int ret = check_token(&p, token); + ret = ret && *p == '='; + if (ret) + *p_ = sskip(p + 1); + + return ret; } void omapsdl_config(void) @@ -49,9 +68,9 @@ void omapsdl_config(void) if (*p == '#') continue; - if (check_token(p, "bind")) { + if (check_token(&p, "bind")) { char *key, *key_end, *sdlkey, *sdlkey_end; - key = sskip(p + 5); + key = p; key_end = nsskip(key); p = sskip(key_end); if (*p != '=') @@ -66,6 +85,10 @@ void omapsdl_config(void) omapsdl_input_bind(key, sdlkey); continue; } + else if (check_token_eq(&p, "force_vsync")) { + gcfg_force_vsync = strtol(p, NULL, 0); + continue; + } bad: err("config: failed to parse: %s", line);