From d77295b722fe2e784a761c467ac5613ebca0aae8 Mon Sep 17 00:00:00 2001 From: Daniel Lopez Date: Sat, 13 Jun 2015 23:09:33 +0100 Subject: [PATCH 1/2] In SDL version command line, don't look for depth in -resolution -showusage says, and the Windows version looks for, "x[@]", but the SDL version was scanning for "x[x][@]", with the effect of silently ignoring refreshrate if depth was omitted. And if given, the depth didn't appear to be used anywhere anyway. --- src/osd/sdl/video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index fa0c8e28bb4..f5b9b115acc 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -756,6 +756,6 @@ static void get_resolution(const char *defdata, const char *data, osd_window_con data = defdata; } - if (sscanf(data, "%dx%dx%d@%d", &config->width, &config->height, &config->depth, &config->refresh) < 2 && report_error) + if (sscanf(data, "%dx%d@%d", &config->width, &config->height, &config->refresh) < 2 && report_error) osd_printf_error("Illegal resolution value = %s\n", data); } From 6ccbaeda7edea3d86f1b54316c44d6151bb6a22e Mon Sep 17 00:00:00 2001 From: Daniel Lopez Date: Sun, 14 Jun 2015 20:02:48 +0100 Subject: [PATCH 2/2] Fix/extend parsing of -resolution command line arg In both Windows and SDL builds, format of -resolution can now be any of: x xx xx@ x@ Omitted values are defaulted to 0, at the point of parsing (as before). --- src/osd/sdl/video.c | 7 ++++++- src/osd/windows/video.c | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/osd/sdl/video.c b/src/osd/sdl/video.c index f5b9b115acc..f9b18c9041f 100644 --- a/src/osd/sdl/video.c +++ b/src/osd/sdl/video.c @@ -756,6 +756,11 @@ static void get_resolution(const char *defdata, const char *data, osd_window_con data = defdata; } - if (sscanf(data, "%dx%d@%d", &config->width, &config->height, &config->refresh) < 2 && report_error) + if (sscanf(data, "%dx%dx%d", &config->width, &config->height, &config->depth) < 2 && report_error) osd_printf_error("Illegal resolution value = %s\n", data); + + const char * at_pos = strchr(data, '@'); + if (at_pos) + if (sscanf(at_pos + 1, "%d", &config->refresh) < 1 && report_error) + osd_printf_error("Illegal refresh rate in resolution value = %s\n", data); } diff --git a/src/osd/windows/video.c b/src/osd/windows/video.c index d135d7a2bc9..7d13ac0acaa 100644 --- a/src/osd/windows/video.c +++ b/src/osd/windows/video.c @@ -508,6 +508,12 @@ static void get_resolution(const char *defdata, const char *data, osd_window_con return; data = defdata; } - if (sscanf(data, "%dx%d@%d", &config->width, &config->height, &config->refresh) < 2 && report_error) + + if (sscanf(data, "%dx%dx%d", &config->width, &config->height, &config->depth) < 2 && report_error) osd_printf_error("Illegal resolution value = %s\n", data); + + const char * at_pos = strchr(data, '@'); + if (at_pos) + if (sscanf(at_pos + 1, "%d", &config->refresh) < 1 && report_error) + osd_printf_error("Illegal refresh rate in resolution value = %s\n", data); }