]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Specialmonitors wip
authorToni Wilen <twilen@winuae.net>
Fri, 22 May 2026 15:23:22 +0000 (18:23 +0300)
committerToni Wilen <twilen@winuae.net>
Fri, 22 May 2026 15:23:22 +0000 (18:23 +0300)
custom.cpp
include/specialmonitors.h
specialmonitors.cpp

index d518b384c3ee020f758df9861980bd7fe9a03830..d4b4c4102f7ea47f94641acab85034a6611ade60 100644 (file)
@@ -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;
index 5f887809f250cfcf35b78014e5e505a9c162a32d..17cfe423dbb3c283cddfba73088c306ce2e0c342 100644 (file)
@@ -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[];
index 2f35ef49b758bb43450eb9abdae83b6745495e7c..163b8afa9263f70144ade157a631eceab0bd0f5e 100755 (executable)
@@ -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;