From a7d7960c0e51d96cb8ea10a24005179bb8239cb2 Mon Sep 17 00:00:00 2001 From: sorgelig Date: Wed, 2 May 2018 22:03:47 +0800 Subject: [PATCH] Adjust custom video mode format (old format is also supported). --- MiSTer.ini | 4 ++-- user_io.cpp | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/MiSTer.ini b/MiSTer.ini index 1b5a0d8..c680859 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -29,8 +29,8 @@ dvi_mode=0 ; set to 1 for DVI mode. Audio won't be transmitted throu ;10 - 1366x768@60 ;11 - 1024x600@60 ; -; custom mode: 1,hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix -; 1,1280,110,40,220,720,5,5,20,74.25 +; custom mode: hact,hfp,hs,hbp,vact,vfp,vs,vbp,Fpix_in_KHz +; video_mode=1280,110,40,220,720,5,5,20,74250 video_mode=0 ; set to 1-10 (seconds) to display video info on startup/change diff --git a/user_io.cpp b/user_io.cpp index 8dc90ac..4444b0d 100644 --- a/user_io.cpp +++ b/user_io.cpp @@ -2123,13 +2123,14 @@ static int parse_custom_video_mode() { char *vcfg = cfg.video_conf; + int khz = 0; int cnt = 0; while (*vcfg) { char *next; if (cnt == 9 && vitems[0] == 1) { - double Fpix = strtod(vcfg, &next); + double Fpix = khz ? strtoul(vcfg, &next, 0)/1000.f : strtod(vcfg, &next); if (vcfg == next || (Fpix < 20.f || Fpix > 200.f)) { printf("Error parsing video_mode parameter: ""%s""\n", cfg.video_conf); @@ -2147,6 +2148,11 @@ static int parse_custom_video_mode() return 0; } + if (!cnt && val >= 100) + { + vitems[cnt++] = 1; + khz = 1; + } if (cnt < 32) vitems[cnt] = val; if (*next == ',') next++; vcfg = next;