diff --git a/input.cpp b/input.cpp index 95c141c..917eafb 100644 --- a/input.cpp +++ b/input.cpp @@ -5864,6 +5864,7 @@ int input_test(int getchar) cmd[len] = 0; printf("MiSTer_cmd: %s\n", cmd); if (!strncmp(cmd, "fb_cmd", 6)) video_cmd(cmd); + else if (!strncmp(cmd, "video_mode ", 11)) video_mode_cmd(cmd + 11); else if (!strncmp(cmd, "load_core ", 10)) { if(isXmlName(cmd)) xml_load(cmd + 10); diff --git a/video.cpp b/video.cpp index 777d14e..3e43d05 100644 --- a/video.cpp +++ b/video.cpp @@ -3900,6 +3900,23 @@ void video_cmd(char *cmd) } } +void video_mode_cmd(char *cmd) +{ + vmode_custom_t v = {}; + int ret = parse_custom_video_mode(cmd, &v); + if (ret != -2) + { + printf("video_mode_cmd: only custom modelines are supported, got \"%s\"\n", cmd); + return; + } + + v_def = v; + v_cur = v; + video_set_mode(&v, v.Fpix); + user_io_send_buttons(1); + printf("video_mode_cmd: applied mode \"%s\"\n", cmd); +} + static constexpr int CELL_GRAN_RND = 4; static int determine_vsync(int w, int h) diff --git a/video.h b/video.h index 6225a80..8cd39bc 100644 --- a/video.h +++ b/video.h @@ -67,6 +67,7 @@ void video_menu_bg(int n, int idle = 0); int video_bg_has_picture(); int video_chvt(int num); void video_cmd(char *cmd); +void video_mode_cmd(char *cmd); void video_core_description(char *str, size_t len); void video_scaler_description(char *str, size_t len);