From 5198ab8e7ee90289ad175525ef86e24e8f15433b Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 22 May 2026 18:23:22 +0300 Subject: [PATCH] Specialmonitors wip --- custom.cpp | 6 +++++- include/specialmonitors.h | 4 +++- specialmonitors.cpp | 36 ++++++++++++++++++++++++++++++------ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/custom.cpp b/custom.cpp index d518b384..d4b4c410 100644 --- a/custom.cpp +++ b/custom.cpp @@ -695,7 +695,7 @@ static uae_s16 bpl1mod, bpl2mod; static uaecptr bplpt[MAX_PLANES]; -uae_u16 bplcon0; +static uae_u16 bplcon0; static uae_u16 bplcon1, bplcon2, bplcon3, bplcon4; static uae_u32 bplcon0_res, bplcon0_planes, bplcon0_planes_limit; static int diwstrt, diwstop, diwhigh; @@ -3563,6 +3563,10 @@ static void BPLCON0(uae_u16 v) return; } +#ifdef WITH_SPECIALMONITORS + specialmonitor_gaudio((v & 0x0100) != 0, vpos); +#endif + // UHRES, BYPASS if (va & (0x0080 | 0x0020)) { not_safe_mode |= 1; diff --git a/include/specialmonitors.h b/include/specialmonitors.h index 5f887809..17cfe423 100644 --- a/include/specialmonitors.h +++ b/include/specialmonitors.h @@ -4,7 +4,6 @@ #include "memory.h" bool emulate_specialmonitors(struct vidbuffer *src, struct vidbuffer *dst); -void specialmonitor_store_fmode(int vpos, int hpos, uae_u16 fmode); void specialmonitor_reset(void); bool specialmonitor_need_genlock(void); bool specialmonitor_uses_control_lines(void); @@ -14,6 +13,9 @@ bool emulate_grayscale(struct vidbuffer*, struct vidbuffer*); bool specialmonitor_linebased(void); void genlock_infotext(uae_u8*, struct vidbuffer*); +void specialmonitor_store_fmode(int vpos, int hpos, uae_u16 fmode); +void specialmonitor_gaudio(bool, int); + extern const TCHAR *specialmonitorfriendlynames[]; extern const TCHAR *specialmonitormanufacturernames[]; extern const TCHAR *specialmonitorconfignames[]; diff --git a/specialmonitors.cpp b/specialmonitors.cpp index 2f35ef49..163b8afa 100755 --- a/specialmonitors.cpp +++ b/specialmonitors.cpp @@ -84,6 +84,7 @@ static int monitor; extern uae_u16 bplcon0; static uae_u8 graffiti_palette[256 * 4]; +static bool graffiti_gaudio; static bool specialmonitor_setresolution(struct vidbuffer *src, struct vidbuffer *dst, int width, int height, bool nativeposition) { @@ -1870,6 +1871,11 @@ static bool do_hame(struct vidbuffer *src, struct vidbuffer *dst) return v; } +void specialmonitor_gaudio(bool gaudio, int vpos) +{ + graffiti_gaudio |= gaudio; +} + static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) { struct vidbuf_description *avidinfo = &adisplays[dst->monitor_id].gfxvidinfo; @@ -1877,14 +1883,16 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) int ystart, yend, isntsc; int xstart, xend; uae_u8 *srcbuf, *srcend; - uae_u8 *dstbuf; + uae_u8 *dstbuf, *dstbufend; bool command, hires, found; int xadd, xpixadd, extrapix; int waitline = 0, dbl; uae_u8 read_mask = 0xff, color = 0, color2 = 0; - if (!(bplcon0 & 0x0100)) // GAUD + if (!graffiti_gaudio) { return false; + } + graffiti_gaudio = false; command = true; found = false; @@ -1911,19 +1919,35 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) } srcbuf = src->bufmem + (((ystart << VRES_MAX) - src->yoffset) / avidinfo->ychange) * src->rowbytes + (((xstart << RES_MAX) - src->xoffset) / avidinfo->xchange) * src->pixbytes; + + srcbuf = src->bufmem; + srcend = src->bufmem + (((yend << VRES_MAX) - src->yoffset) / avidinfo->ychange) * src->rowbytes; extrapix = 0; dstbuf = dst->bufmem + (((ystart << VRES_MAX) - src->yoffset) / avidinfo->ychange) * dst->rowbytes + (((xstart << RES_MAX) - src->xoffset) / avidinfo->xchange) * dst->pixbytes; + dstbufend = dst->bufmemend - 8 * dst->width_allocated * dst->pixbytes; y = 0; - while (srcend > srcbuf && dst->bufmemend > dstbuf) { + while (srcend > srcbuf && dstbufend > dstbuf) { uae_u8 *srcp = srcbuf + extrapix; uae_u8 *dstp = dstbuf; x = xstart; + bool first = true; while (x < xend) { + if (command && first) { + if (FR(src, srcp) || FG(src, srcp) || FB(src, srcp) || FI(src, srcp)) { + first = false; + } else { + x += xpixadd; + srcp += xadd; + dstp += dst->pixbytes * xpixadd; + continue; + } + } + uae_u8 mask = 0x80; uae_u8 chunky[4] = { 0, 0, 0, 0 }; while (mask) { @@ -1953,7 +1977,7 @@ static bool graffiti(struct vidbuffer *src, struct vidbuffer *dst) command = false; dbl = 1; waitline = 2; - if (0 && (cmd & 16)) { + if (cmd & 16) { hires = true; xadd /= 2; xpixadd /= 2; @@ -2126,7 +2150,7 @@ static bool a2024(struct vidbuffer *src, struct vidbuffer *dst) panel_width_draw = px == 2 ? 352 : 336; pxcnt = 3; hires = false; - srcxoffset = (112 << RES_MAX) - 360; + srcxoffset = (112 << RES_MAX) - 360; // 112*4-360=88 (312) 112*4-272=176 (172) if (px > 2) return false; total_width = 336 + 336 + 352; @@ -2135,7 +2159,7 @@ static bool a2024(struct vidbuffer *src, struct vidbuffer *dst) panel_width_draw = 512; pxcnt = 2; hires = true; - srcxoffset = (128 << RES_MAX) - 360; + srcxoffset = (128 << RES_MAX) - 360; // 128*4-360=152 (312) 128*4-272=240 (172) if (px > 1) return false; total_width = 512 + 512; -- 2.47.3