diff --git a/MiSTer.ini b/MiSTer.ini index cccd5eb..26f3674 100644 --- a/MiSTer.ini +++ b/MiSTer.ini @@ -24,6 +24,7 @@ fb_size=0 ; 0 - automatic, 1 - full size, 2 - 1/2 of resolution, 4 fb_terminal=1 ; 1 - enabled (default), 0 - disabled osd_timeout=30 ; 5-3600 timeout (in seconds) for OSD to disappear in Menu core. 0 - never timeout. ; Background picture will get darker after double timeout +video_off=0 ; output black frame in Menu core after timeout (is seconds). Valid only if osd_timout is non zero. osd_rotate=0 ; Display OSD menu rotated, 0 - no rotation, 1 - rotate right (+90°), 2 - rotate left (-90°) vga_sog=0 ; 1 - enable sync on green (needs analog I/O board v6.0 or newer). diff --git a/cfg.cpp b/cfg.cpp index 395c96b..9f4de31 100644 --- a/cfg.cpp +++ b/cfg.cpp @@ -100,6 +100,7 @@ static const ini_var_t ini_vars[] = { "VRR_MIN_FRAMERATE", (void *)(&(cfg.vrr_min_framerate)), UINT8, 0, 255}, { "VRR_MAX_FRAMERATE", (void *)(&(cfg.vrr_max_framerate)), UINT8, 0, 255}, { "VRR_VESA_FRAMERATE", (void *)(&(cfg.vrr_vesa_framerate)), UINT8, 0, 255}, + { "VIDEO_OFF", (void*)(&(cfg.video_off)), INT16, 0, 3600 }, }; static const int nvars = (int)(sizeof(ini_vars) / sizeof(ini_var_t)); diff --git a/cfg.h b/cfg.h index e4f1e2b..2078df3 100644 --- a/cfg.h +++ b/cfg.h @@ -77,6 +77,7 @@ typedef struct { uint8_t vrr_min_framerate; uint8_t vrr_max_framerate; uint8_t vrr_vesa_framerate; + uint16_t video_off; } cfg_t; extern cfg_t cfg; diff --git a/menu.cpp b/menu.cpp index 44d215b..ff0f56e 100644 --- a/menu.cpp +++ b/menu.cpp @@ -1043,6 +1043,7 @@ void HandleUI(void) { static int menu_visible = 1; static unsigned long timeout = 0; + static unsigned long off_timeout = 0; if (!video_fb_state() && cfg.fb_terminal) { if (timeout && CheckTimer(timeout)) @@ -1058,9 +1059,16 @@ void HandleUI(void) { menu_visible--; video_menu_bg(user_io_status_get("[3:1]"), 2); + off_timeout = cfg.video_off ? GetTimer(cfg.video_off * 1000) : 0; } } + if (off_timeout && CheckTimer(off_timeout) && menu_visible < 0) + { + off_timeout = 0; + video_menu_bg(user_io_status_get("[3:1]"), 3); + } + if (c || menustate != MENU_FILE_SELECT2) { timeout = 0; diff --git a/video.cpp b/video.cpp index ce463df..9548695 100644 --- a/video.cpp +++ b/video.cpp @@ -423,7 +423,7 @@ static bool read_video_filter(int type, VideoFilter *out) out->is_adaptive = false; valid = scale_phases(out->phases, phases, count); } - + if (!valid) { // Make a default NN filter in case of error @@ -2389,7 +2389,7 @@ void video_mode_adjust() } else if (cfg_has_video_sections()) // if we have video sections but aren't updating the resolution for other reasons, then do it here { - video_set_mode(&v_def, 0); + video_set_mode(&v_def, 0); user_io_send_buttons(1); force = true; } @@ -2892,54 +2892,57 @@ void video_menu_bg(int n, int idle) draw_black(); - switch (n) + if (idle < 3) { - case 1: - if (!menubg) menubg = load_bg(); - if (menubg) + switch (n) { - imlib_context_set_image(menubg); - int src_w = imlib_image_get_width(); - int src_h = imlib_image_get_height(); - //printf("menubg: src_w=%d, src_h=%d\n", src_w, src_h); + case 1: + if (!menubg) menubg = load_bg(); + if (menubg) + { + imlib_context_set_image(menubg); + int src_w = imlib_image_get_width(); + int src_h = imlib_image_get_height(); + //printf("menubg: src_w=%d, src_h=%d\n", src_w, src_h); - if (*bg) - { - imlib_context_set_image(*bg); - imlib_blend_image_onto_image(menubg, 0, - 0, 0, //int source_x, int source_y, - src_w, src_h, //int source_width, int source_height, - brd_x, brd_y, //int destination_x, int destination_y, - fb_width - (brd_x * 2), fb_height - (brd_y * 2) //int destination_width, int destination_height - ); - bg_has_picture = 1; - break; - } - else - { - printf("*bg = 0!\n"); + if (*bg) + { + imlib_context_set_image(*bg); + imlib_blend_image_onto_image(menubg, 0, + 0, 0, //int source_x, int source_y, + src_w, src_h, //int source_width, int source_height, + brd_x, brd_y, //int destination_x, int destination_y, + fb_width - (brd_x * 2), fb_height - (brd_y * 2) //int destination_width, int destination_height + ); + bg_has_picture = 1; + break; + } + else + { + printf("*bg = 0!\n"); + } } + draw_checkers(); + break; + case 2: + draw_hbars1(); + break; + case 3: + draw_hbars2(); + break; + case 4: + draw_vbars1(); + break; + case 5: + draw_vbars2(); + break; + case 6: + draw_spectrum(); + break; + case 7: + draw_black(); + break; } - draw_checkers(); - break; - case 2: - draw_hbars1(); - break; - case 3: - draw_hbars2(); - break; - case 4: - draw_vbars1(); - break; - case 5: - draw_vbars2(); - break; - case 6: - draw_spectrum(); - break; - case 7: - draw_black(); - break; } if (cfg.logo && logo && !idle)