From 3f5c48603d82443cf8cf85c2dfd9ee803f435de7 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 22 Feb 2019 16:39:33 +0200 Subject: [PATCH] Video port adapter all doubling mode support. Genlock/CD32FMV output/video was not in grayscale mode if grayscale was enabled. --- drawing.cpp | 23 +++++++++------ specialmonitors.cpp | 72 +++++++++++++++++++++++++++++++++------------ 2 files changed, 67 insertions(+), 28 deletions(-) diff --git a/drawing.cpp b/drawing.cpp index 5fd159c4..d3bb93a3 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -4073,6 +4073,7 @@ static void finish_drawing_frame(bool drawlines) draw_frame_extras(vb, -1, -1); + // video port adapters if (currprefs.monitoremu) { struct vidbuf_description *outvi = &adisplays[currprefs.monitoremu_mon].gfxvidinfo; struct vidbuffer *out = &outvi->drawbuffer; @@ -4119,20 +4120,13 @@ static void finish_drawing_frame(bool drawlines) } } - if (!currprefs.monitoremu && vidinfo->tempbuffer.bufmem_allocated && ((!bplcolorburst_field && currprefs.cs_color_burst) || (currprefs.gfx_grayscale))) { - setspecialmonitorpos(&vidinfo->tempbuffer); - emulate_grayscale(vb, &vidinfo->tempbuffer); - vb = vidinfo->outbuffer = &vidinfo->tempbuffer; - if (vb->nativepositioning) - setnativeposition(vb); - vidinfo->drawbuffer.tempbufferinuse = true; - } - + // genlock if (currprefs.genlock_image && !currprefs.monitoremu && !currprefs.cs_color_burst && vidinfo->tempbuffer.bufmem_allocated && currprefs.genlock) { setspecialmonitorpos(&vidinfo->tempbuffer); if (init_genlock_data != specialmonitor_need_genlock()) { need_genlock_data = init_genlock_data = specialmonitor_need_genlock(); init_row_map(); + pfield_set_linetoscr(); } emulate_genlock(vb, &vidinfo->tempbuffer); vb = vidinfo->outbuffer = &vidinfo->tempbuffer; @@ -4141,6 +4135,7 @@ static void finish_drawing_frame(bool drawlines) vidinfo->drawbuffer.tempbufferinuse = true; } + // cd32 fmv if (!currprefs.monitoremu && vidinfo->tempbuffer.bufmem_allocated && currprefs.cs_cd32fmv) { if (cd32_fmv_active) { cd32_fmv_genlock(vb, &vidinfo->tempbuffer); @@ -4152,6 +4147,16 @@ static void finish_drawing_frame(bool drawlines) } } + // grayscale + if (!currprefs.monitoremu && vidinfo->tempbuffer.bufmem_allocated && ((!bplcolorburst_field && currprefs.cs_color_burst) || (currprefs.gfx_grayscale))) { + setspecialmonitorpos(&vidinfo->tempbuffer); + emulate_grayscale(vb, &vidinfo->tempbuffer); + vb = vidinfo->outbuffer = &vidinfo->tempbuffer; + if (vb->nativepositioning) + setnativeposition(vb); + vidinfo->drawbuffer.tempbufferinuse = true; + } + unlockscr(vb, -1, -1); } diff --git a/specialmonitors.cpp b/specialmonitors.cpp index fc1c8407..90ceca9e 100755 --- a/specialmonitors.cpp +++ b/specialmonitors.cpp @@ -724,14 +724,20 @@ static bool do_dctv(struct vidbuffer *src, struct vidbuffer *dst) if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = dctv(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 2) blank_generic(src, dst, lof_store ? 1 : 0); } else { v = dctv(src, dst, false, 0); v |= dctv(src, dst, false, 1); } } else { - v = dctv(src, dst, true, 0); + if (currprefs.gfx_pscanlines) { + v = dctv(src, dst, false, lof_store ? 0 : 1); + if (v && currprefs.gfx_pscanlines >= 2) + dctv(src, dst, false, lof_store ? 1 : 0); + } else { + v = dctv(src, dst, true, 0); + } } return v; } @@ -1206,14 +1212,20 @@ static bool do_firecracker24(struct vidbuffer *src, struct vidbuffer *dst) if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = firecracker24(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 2) blank_generic(src, dst, lof_store ? 1 : 0); } else { v = firecracker24(src, dst, false, 0); v |= firecracker24(src, dst, false, 1); } } else { - v = firecracker24(src, dst, true, 0); + if (currprefs.gfx_pscanlines) { + v = firecracker24(src, dst, false, lof_store ? 0 : 1); + if (v && currprefs.gfx_pscanlines >= 2) + firecracker24(src, dst, false, lof_store ? 1 : 0); + } else { + v = firecracker24(src, dst, true, 0); + } } return v; } @@ -1537,19 +1549,24 @@ static bool do_avideo(struct vidbuffer *src, struct vidbuffer *dst) if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = avideo(src, dst, false, lof, lof); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 2) blank_generic(src, dst, !lof); } else { v = avideo(src, dst, false, 0, 0); v |= avideo(src, dst, false, 1, 1); } } else { - v = avideo(src, dst, true, 0, lof); + if (currprefs.gfx_pscanlines) { + v = avideo(src, dst, false, lof_store ? 0 : 1, lof); + if (v && currprefs.gfx_pscanlines >= 2) + avideo(src, dst, false, lof_store ? 1 : 0, lof); + } else { + v = avideo(src, dst, true, 0, lof); + } } return v; } - static bool videodac18(struct vidbuffer *src, struct vidbuffer *dst, bool doublelines, int oddlines) { struct vidbuf_description *avidinfo = &adisplays[dst->monitor_id].gfxvidinfo; @@ -1640,14 +1657,20 @@ static bool do_videodac18(struct vidbuffer *src, struct vidbuffer *dst) if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = videodac18(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 2) blank_generic(src, dst, lof_store ? 1 : 0); } else { v = videodac18(src, dst, false, 0); v |= videodac18(src, dst, false, 1); } } else { - v = videodac18(src, dst, true, 0); + if (currprefs.gfx_pscanlines) { + v = videodac18(src, dst, false, lof_store ? 0 : 1); + if (v && currprefs.gfx_pscanlines >= 2) + videodac18(src, dst, false, lof_store ? 1 : 0); + } else { + v = videodac18(src, dst, true, 0); + } } return v; } @@ -1860,14 +1883,20 @@ static bool do_hame(struct vidbuffer *src, struct vidbuffer *dst) if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = ham_e(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 1) blank_generic(src, dst, lof_store ? 1 : 0); } else { v = ham_e(src, dst, false, 0); v |= ham_e(src, dst, false, 1); } } else { - v = ham_e(src, dst, true, 0); + if (currprefs.gfx_pscanlines) { + v = ham_e(src, dst, false, lof_store ? 0 : 1); + if (v && currprefs.gfx_pscanlines >= 2) + ham_e(src, dst, false, lof_store ? 1 : 0); + } else { + v = ham_e(src, dst, true, 0); + } } return v; } @@ -2630,8 +2659,8 @@ bool emulate_genlock(struct vidbuffer *src, struct vidbuffer *dst) } else { if (currprefs.gfx_pscanlines) { v = do_genlock(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_pscanlines > 1) - blank_generic(src, dst, lof_store ? 1 : 0); + if (v && currprefs.gfx_pscanlines >= 2) + do_genlock(src, dst, false, lof_store ? 1 : 0); } else { v = do_genlock(src, dst, true, 0); } @@ -2702,7 +2731,7 @@ bool emulate_grayscale(struct vidbuffer *src, struct vidbuffer *dst) if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = do_grayscale(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 2) blank_generic(src, dst, lof_store ? 1 : 0); } else { v = do_grayscale(src, dst, false, 0); @@ -2711,8 +2740,8 @@ bool emulate_grayscale(struct vidbuffer *src, struct vidbuffer *dst) } else { if (currprefs.gfx_pscanlines) { v = do_grayscale(src, dst, false, lof_store ? 0 : 1); - if (v && currprefs.gfx_pscanlines > 1) - blank_generic(src, dst, lof_store ? 1 : 0); + if (v && currprefs.gfx_pscanlines >= 2) + do_grayscale(src, dst, false, lof_store ? 1 : 0); } else { v = do_grayscale(src, dst, true, 0); } @@ -3495,19 +3524,24 @@ static bool do_opalvision(struct vidbuffer *src, struct vidbuffer *dst, int line if (interlace_seen) { if (currprefs.gfx_iscanlines) { v = opalvision(src, dst, false, lof_store ? 0 : 1, line, opal); - if (v && currprefs.gfx_iscanlines > 1) + if (v && currprefs.gfx_iscanlines >= 1) blank_generic(src, dst, lof_store ? 1 : 0); } else { v = opalvision(src, dst, false, 0, line, opal); v |= opalvision(src, dst, false, 1, line, opal); } } else { - v = opalvision(src, dst, true, 0, line, opal); + if (currprefs.gfx_pscanlines) { + v = opalvision(src, dst, false, lof_store ? 0 : 1, line, opal); + if (v && currprefs.gfx_pscanlines >= 2) + opalvision(src, dst, false, lof_store ? 1 : 0, line, opal); + } else { + v = opalvision(src, dst, true, 0, line, opal); + } } return v; } - static bool emulate_specialmonitors2(struct vidbuffer *src, struct vidbuffer *dst, int line) { automatic = false; -- 2.47.3