]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Picasso96 2.5.0+ screen dragging support.
authorToni Wilen <twilen@winuae.net>
Sat, 29 Aug 2020 17:03:51 +0000 (20:03 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 29 Aug 2020 17:03:51 +0000 (20:03 +0300)
od-win32/picasso96_win.cpp
od-win32/picasso96_win.h
od-win32/win32gfx.cpp

index cfedcb735044f47a7e2574839bbb0a07e1665d0f..443282239efd7a4bf93dd582fa9bb23160abf17f 100644 (file)
@@ -184,8 +184,8 @@ static int overlay_vram_offset;
 static int overlay_active;
 static int overlay_convert;
 static int overlay_occlusion;
-static struct MyCLUTEntry overlay_clutc[256];
-static uae_u32 overlay_clut[256];
+static struct MyCLUTEntry overlay_clutc[256 * 2];
+static uae_u32 overlay_clut[256 * 2];
 static uae_u32 *p96_rgbx16_ovl;
 
 static int uaegfx_old, uaegfx_active;
@@ -1648,11 +1648,16 @@ d7: RGBFTYPE RGBFormat
 */
 static uae_u32 REGPARAM2 picasso_SetSpritePosition (TrapContext *ctx)
 {
-       struct picasso96_state_struct *state = &picasso96_state[currprefs.rtgboards[0].monitor_id];
+       int monid = currprefs.rtgboards[0].monitor_id;
+       struct picasso96_state_struct *state = &picasso96_state[monid];
+       struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
        uaecptr bi = trap_get_areg(ctx, 0);
        boardinfo = bi;
        int x = (uae_s16)trap_get_word(ctx, bi + PSSO_BoardInfo_MouseX) - state->XOffset;
        int y = (uae_s16)trap_get_word(ctx, bi + PSSO_BoardInfo_MouseY) - state->YOffset;
+       if (vidinfo->splitypos >= 0) {
+               y += vidinfo->splitypos;
+       }
        newcursor_x = x;
        newcursor_y = y;
        if (!hwsprite)
@@ -2593,6 +2598,7 @@ static void inituaegfx(TrapContext *ctx, uaecptr ABI)
 #if OVERLAY
        flags |= BIF_VIDEOWINDOW;
 #endif
+       flags |= BIF_VGASCREENSPLIT;
        trap_put_long(ctx, ABI + PSSO_BoardInfo_Flags, flags);
        if (debug_rtg_blitter != 3)
                write_log (_T("P96: Blitter mode = %x!\n"), debug_rtg_blitter);
@@ -2777,7 +2783,7 @@ void picasso_enablescreen(int monid, int on)
 
 static void resetpalette(struct picasso96_state_struct *state)
 {
-       for (int i = 0; i < 256; i++)
+       for (int i = 0; i < 256 * 2; i++)
                state->CLUT[i].Pad = 0xff;
 }
 
@@ -2818,11 +2824,9 @@ static int updateclut(TrapContext *ctx, uaecptr clut, int start, int count)
                state->CLUT[i].Red = r;
                state->CLUT[i].Green = g;
                state->CLUT[i].Blue = b;
-               if (uaegfx) {
-                       state->CLUT[i].Red = r;
-                       state->CLUT[i].Green = g;
-                       state->CLUT[i].Blue = b;
-               }
+               state->CLUT[i + 256].Red = r;
+               state->CLUT[i + 256].Green = g;
+               state->CLUT[i + 256].Blue = b;
        }
 
        changed |= picasso_palette(state->CLUT, vidinfo->clut);
@@ -3019,6 +3023,22 @@ static uae_u32 REGPARAM2 picasso_SetPanning (TrapContext *ctx)
        return 1;
 }
 
+
+static uae_u32 picasso_SetSplitPosition(TrapContext *ctx)
+{
+       lockrtg();
+       int monid = currprefs.rtgboards[0].monitor_id;
+       struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
+
+       uae_s16 pos = trap_get_dreg(ctx, 0) - 1;
+       if (pos != vidinfo->splitypos) {
+               vidinfo->splitypos = pos;
+               vidinfo->full_refresh = 1;
+       }
+       unlockrtg();
+       return 1;
+}
+
 #ifdef CPU_64_BIT
 static void do_xor8 (uae_u8 *p, int w, uae_u32 v)
 {
@@ -4205,11 +4225,19 @@ void picasso_statusline(int monid, uae_u8 *dst)
 static void copyrow (int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int width, int srcbytesperrow, int srcpixbytes, int dx, int dy, int dstbytesperrow, int dstpixbytes, bool direct, int convert_mode, uae_u32 *p96_rgbx16p)
 {
        struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
-       uae_u8 *src2 = src + y * srcbytesperrow;
-       uae_u8 *dst2 = dst + dy * dstbytesperrow;
        int endx = x + width, endx4;
        int dstpix = dstpixbytes;
        int srcpix = srcpixbytes;
+       uae_u32 *clut = vidinfo->clut;
+
+       if (y >= vidinfo->splitypos && vidinfo->splitypos >= 0) {
+               src = gfxmem_banks[monid]->start + natmem_offset;
+               clut += 256;
+               y -= vidinfo->splitypos;
+       }
+
+       uae_u8 *src2 = src + y * srcbytesperrow;
+       uae_u8 *dst2 = dst + dy * dstbytesperrow;
 
        if (direct) {
                memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
@@ -4421,26 +4449,26 @@ static void copyrow (int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int widt
        case RGBFB_CLUT_RGBFB_32:
                {
                        while ((x & 3) && x < endx) {
-                               ((uae_u32*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u32*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
                        }
                        while (x < endx4) {
-                               ((uae_u32*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u32*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
-                               ((uae_u32*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u32*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
-                               ((uae_u32*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u32*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
-                               ((uae_u32*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u32*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
                        }
                        while (x < endx) {
-                               ((uae_u32*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u32*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
                        }
@@ -4451,26 +4479,26 @@ static void copyrow (int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int widt
        case RGBFB_CLUT_RGBFB_16:
                {
                        while ((x & 3) && x < endx) {
-                               ((uae_u16*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u16*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
                        }
                        while (x < endx4) {
-                               ((uae_u16*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u16*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
-                               ((uae_u16*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u16*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
-                               ((uae_u16*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u16*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
-                               ((uae_u16*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u16*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
                        }
                        while (x < endx) {
-                               ((uae_u16*)dst2)[dx] = vidinfo->clut[src2[x]];
+                               ((uae_u16*)dst2)[dx] = clut[src2[x]];
                                x++;
                                dx++;
                        }
@@ -5039,13 +5067,18 @@ void fb_copyrow(int monid, uae_u8 *src, uae_u8 *dst, int x, int y, int width, in
 
 static void copyallinvert(int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheight, int srcbytesperrow, int srcpixbytes, int dstbytesperrow, int dstpixbytes, bool direct, int mode_convert)
 {
+       struct picasso_vidbuf_description *vidinfo = &picasso_vidinfo[monid];
        int x, y, w;
 
        w = pwidth * dstpixbytes;
        if (direct) {
                for (y = 0; y < pheight; y++) {
-                       for (x = 0; x < w; x++)
+                       if (y == vidinfo->splitypos) {
+                               src = gfxmem_banks[monid]->start + natmem_offset;
+                       }
+                       for (x = 0; x < w; x++) {
                                dst[x] = src[x] ^ 0xff;
+                       }
                        dst += dstbytesperrow;
                        src += srcbytesperrow;
                }
@@ -5070,13 +5103,17 @@ static void copyall (int monid, uae_u8 *src, uae_u8 *dst, int pwidth, int pheigh
        if (direct) {
                int w = pwidth * vidinfo->pixbytes;
                for (y = 0; y < pheight; y++) {
+                       if (y == vidinfo->splitypos) {
+                               src = gfxmem_banks[monid]->start + natmem_offset;
+                       }
                        memcpy (dst, src, w);
                        dst += dstbytesperrow;
                        src += srcbytesperrow;
                }
        } else {
-               for (y = 0; y < pheight; y++)
-                       copyrow (monid, src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, 0, y, dstbytesperrow, dstpixbytes, direct, mode_convert, p96_rgbx16);
+               for (y = 0; y < pheight; y++) {
+                       copyrow(monid, src, dst, 0, y, pwidth, srcbytesperrow, srcpixbytes, 0, y, dstbytesperrow, dstpixbytes, direct, mode_convert, p96_rgbx16);
+               }
        }
 }
 
@@ -6155,6 +6192,8 @@ static void inituaegfxfuncs(TrapContext *ctx, uaecptr start, uaecptr ABI)
        RTGCALL2X(PSSO_BoardInfo_DeleteFeature, picasso_DeleteFeature);
 #endif
 
+       RTGCALL2(PSSO_SetSplitPosition, picasso_SetSplitPosition);
+
 #endif
 
        if (currprefs.rtg_hardwareinterrupt)
index bc99664b78ff2e9bc9b7f9c5d209569c94c02fc4..5e10fc70e5cf2efed60623408d5ebe78b6b2087e 100644 (file)
@@ -468,8 +468,8 @@ enum {
 #define PSSO_BoardInfo_Reserved0                   PSSO_BoardInfo_BlitPlanar2DirectDefault + 4
 #define PSSO_BoardInfo_Reserved0Default                    PSSO_BoardInfo_Reserved0 + 4
 #define PSSO_BoardInfo_Reserved1                   PSSO_BoardInfo_Reserved0Default + 4
-#define PSSO_BoardInfo_Reserved1Default                    PSSO_BoardInfo_Reserved1 + 4
-#define PSSO_BoardInfo_Reserved2                   PSSO_BoardInfo_Reserved1Default + 4
+#define PSSO_SetSplitPosition              PSSO_BoardInfo_Reserved1 + 4
+#define PSSO_BoardInfo_Reserved2                   PSSO_SetSplitPosition + 4
 #define PSSO_BoardInfo_Reserved2Default                    PSSO_BoardInfo_Reserved2 + 4
 #define PSSO_BoardInfo_Reserved3                   PSSO_BoardInfo_Reserved2Default + 4
 #define PSSO_BoardInfo_Reserved3Default                    PSSO_BoardInfo_Reserved3 + 4
@@ -542,6 +542,8 @@ enum {
 #define BIB_NEEDSALIGNMENT              2      /* bitmaps have to be aligned (not yet supported!) */
 #define BIB_CACHEMODECHANGE             3      /* board memory may be set to Imprecise (060) or Nonserialised (040) */
 #define BIB_VBLANKINTERRUPT             4      /* board can cause a hardware interrupt on a vertical retrace */
+#define BIB_HASSPRITEBUFFER      5  /* board has allocated memory for software sprite image and save buffer */
+#define BIB_VGASCREENSPLIT       6  /* has a screen B with fixed screen position for split-screens */
 #define BIB_DBLSCANDBLSPRITEY   8      /* hardware sprite y position is doubled on doublescan display modes */
 #define BIB_ILACEHALFSPRITEY    9      /* hardware sprite y position is halved on interlace display modes */
 #define BIB_ILACEDBLROWOFFSET  10      /* doubled row offset in interlaced display modes needs additional horizontal bit */
@@ -569,6 +571,8 @@ enum {
 #define BIF_NEEDSALIGNMENT             (1 << BIB_NEEDSALIGNMENT)
 #define BIF_CACHEMODECHANGE            (1 << BIB_CACHEMODECHANGE)
 #define BIF_VBLANKINTERRUPT            (1 << BIB_VBLANKINTERRUPT)
+#define BIF_HASSPRITEBUFFER            (1 << BIB_HASSPRITEBUFFER)
+#define BIF_VGASCREENSPLIT             (1 << BIB_VGASCREENSPLIT)
 #define BIF_DBLSCANDBLSPRITEY  (1 << BIB_DBLSCANDBLSPRITEY)
 #define BIF_ILACEHALFSPRITEY   (1 << BIB_ILACEHALFSPRITEY)
 #define BIF_ILACEDBLROWOFFSET  (1 << BIB_ILACEDBLROWOFFSET)
@@ -595,7 +599,7 @@ enum {
 struct picasso96_state_struct
 {
     RGBFTYPE            RGBFormat;   /* true-colour, CLUT, hi-colour, etc.*/
-    struct MyCLUTEntry  CLUT[256];   /* Duh! */
+    struct MyCLUTEntry  CLUT[2 * 256];   /* Duh! */
     uaecptr             Address;     /* Active screen address (Amiga-side)*/
     uaecptr             Extent;      /* End address of screen (Amiga-side)*/
     uae_u16             Width;       /* Active display width  (From SetGC)*/
@@ -649,7 +653,7 @@ struct picasso_vidbuf_description {
        int extra_mem; /* nonzero if there's a second buffer that must be updated */
        uae_u32 rgbformat;
        uae_u32 selected_rgbformat;
-       uae_u32 clut[256];
+       uae_u32 clut[256 * 2];
        int picasso_convert, host_mode;
        int ohost_mode, orgbformat;
        int full_refresh;
@@ -657,6 +661,7 @@ struct picasso_vidbuf_description {
        int rtg_clear_flag;
        bool picasso_active;
        bool picasso_changed;
+    uae_s16 splitypos;
        uae_atomic picasso_state_change;
 };
 
index f6edb2550e2705d47e8f574fc9f7438bf2d0d095..75758800459178681d0f9770def4c3be5b65dc9d 100644 (file)
@@ -2808,7 +2808,7 @@ int picasso_palette(struct MyCLUTEntry *CLUT, uae_u32 *clut)
 {
        int changed = 0;
 
-       for (int i = 0; i < 256; i++) {
+       for (int i = 0; i < 256 * 2; i++) {
                int r = CLUT[i].Red;
                int g = CLUT[i].Green;
                int b = CLUT[i].Blue;