diff --git a/MiSTer.ini b/MiSTer.ini index 4bd5eb0..608246e 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -3,6 +3,7 @@ key_menu_as_rgui=0 ; set to 1 to make the MENU key map to RGUI in Minimig (e forced_scandoubler=0 ; set to 1 to run scandoubler on VGA output always (depends on core). ;ypbpr=0 ; set to 1 for YPbPr on VGA output. (obsolete. see vga_mode) vga_mode=rgb ; supported modes: rgb, ypbpr, svideo, cvbs. rgb is default. +ntsc_mode=0 ; Only for S-Video and CVBS vga_mode. 0 - normal NTSC, 1 - PAL-60, 2 - PAL-M. composite_sync=0 ; set to 1 for composite sync on HSync signal of VGA output. vga_scaler=0 ; set to 1 to connect VGA to scaler output. hdmi_audio_96k=0 ; set to 1 for 96khz/16bit HDMI audio (48khz/16bit otherwise) diff --git a/cfg.cpp b/cfg.cpp index 19c1bb6..dc09c14 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -115,7 +115,8 @@ static const ini_var_t ini_vars[] = { "VIDEO_HUE", (void *)(&(cfg.video_hue)), UINT16, 0, 360}, { "VIDEO_GAIN_OFFSET", (void *)(&(cfg.video_gain_offset)), STRING, 0, sizeof(cfg.video_gain_offset)}, { "HDR", (void*)(&cfg.hdr), UINT8, 0, 2 }, - { "vga_mode", (void*)(&(cfg.vga_mode)), STRING, 0, sizeof(cfg.vga_mode) - 1 }, + { "VGA_MODE", (void*)(&(cfg.vga_mode)), STRING, 0, sizeof(cfg.vga_mode) - 1 }, + { "NTSC_MODE", (void *)(&(cfg.ntsc_mode)), UINT8, 0, 2}, }; static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t)); diff --git a/cfg.h b/cfg.h index 1805dfe..8a86c1f 100644 --- a/cfg.h +++ b/cfg.h @@ -88,6 +88,7 @@ typedef struct { uint8_t hdr; char vga_mode[16]; char vga_mode_int; + char ntsc_mode; } cfg_t; extern cfg_t cfg; diff --git a/video.cpp b/video.cpp index 36b3828..2be7d1f 100644 --- a/video.cpp +++ b/video.cpp @@ -2731,7 +2731,7 @@ static void set_yc_mode() { float fps = current_video_info.vtime ? (100000000.f / current_video_info.vtime) : 0.f; int pal = fps < 55.f; - double CLK_REF = pal ? 4.43361875f : 3.579545f; + double CLK_REF = (pal || (cfg.ntsc_mode == 1)) ? 4.43361875f : (cfg.ntsc_mode == 2) ? 3.575611f : 3.579545f; double CLK_VIDEO = current_video_info.ctime * 100.f / current_video_info.ptime; int64_t PHASE_INC = ((int64_t)((CLK_REF / CLK_VIDEO) * 1099511627776LL)) & 0xFFFFFFFFFFLL; @@ -2741,9 +2741,8 @@ static void set_yc_mode() int COLORBURST_RANGE = (COLORBURST_START << 10) | COLORBURST_END; char yc_key[64]; - sprintf(yc_key, "%s_%.1f%s", user_io_get_core_name(1), fps, current_video_info.interlaced ? "i" : ""); - - printf("Calculated YC parameters for '%s': %s PHASE_INC=%lld, COLORBURST_START=%d, COLORBURST_END=%d\n", yc_key, pal ? "PAL" : "NTSC", PHASE_INC, COLORBURST_START, COLORBURST_END); + sprintf(yc_key, "%s_%.1f%s%s", user_io_get_core_name(1), fps, current_video_info.interlaced ? "i" : "", (pal || !cfg.ntsc_mode) ? "" : (cfg.ntsc_mode == 1) ? "s" : "m"); + printf("Calculated YC parameters for '%s': %s PHASE_INC=%lld, COLORBURST_START=%d, COLORBURST_END=%d\n", yc_key, pal ? "PAL" : (cfg.ntsc_mode == 1) ? "PAL60" : (cfg.ntsc_mode == 2) ? "PAL-M" : "NTSC", PHASE_INC, COLORBURST_START, COLORBURST_END); for (uint i = 0; i < sizeof(yc_modes) / sizeof(yc_modes[0]); i++) { @@ -2756,7 +2755,7 @@ static void set_yc_mode() } spi_uio_cmd_cont(UIO_SET_YC_PAR); - spi_w((pal ? 4 : 0) | ((cfg.vga_mode_int == 3) ? 3 : 1)); + spi_w(((pal || cfg.ntsc_mode) ? 4 : 0) | ((cfg.vga_mode_int == 3) ? 3 : 1)); spi_w(PHASE_INC); spi_w(PHASE_INC >> 16); spi_w(PHASE_INC >> 32);