]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc1500b11.zip
authorToni Wilen <twilen@winuae.net>
Sun, 30 Mar 2008 09:36:50 +0000 (12:36 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:39:33 +0000 (21:39 +0200)
41 files changed:
autoconf.c
blitter.c
cfgfile.c
custom.c
drawing.c
expansion.c
gfxutil.c
include/custom.h
include/inputdevice.h
include/options.h
include/rtgmodes.h [new file with mode: 0755]
include/xwin.h
inputdevice.c
memory.c
od-win32/ahidsound.c
od-win32/cloanto/RetroPlatformGuestIPC.c
od-win32/cloanto/RetroPlatformIPC.h
od-win32/cloanto/RetroPlatformIPC_doc_draft.txt [new file with mode: 0755]
od-win32/dxwrap.c
od-win32/dxwrap.h
od-win32/mman.c
od-win32/parser.c
od-win32/picasso96_win.c
od-win32/picasso96_win.h
od-win32/resources/resource
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/rp.c
od-win32/rp.h
od-win32/screenshot.c
od-win32/sys/mman.h
od-win32/sysconfig.h
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
od-win32/win32gui.h
od-win32/winuae_msvc/winuae_msvc.vcproj
od-win32/winuaechangelog.txt
od-win32/writelog.c
p96_blit.c

index 244654202b33e12100f6695ca22dfae157b5e63f..063f06c8401562f4363ccd8cdd8681a18fe90d65 100755 (executable)
@@ -199,6 +199,7 @@ static void rtarea_init_mem (void)
        write_log ("virtual memory exhausted (rtarea)!\n");
        abort ();
     }
+    memset (rtarea, 0, 0x10000);
     rtarea_bank.baseaddr = rtarea;
 }
 
index fadb1df5d1bf19b9721342e5e4b70326e6bb2830..b57d5677d9ee466e7999a3f530fdb45b7629eadf 100755 (executable)
--- a/blitter.c
+++ b/blitter.c
@@ -9,6 +9,7 @@
 
 //#define BLITTER_DEBUG
 //#define BLITTER_SLOWDOWNDEBUG 4
+//#define BLITTER_DEBUG_NO_D
 
 #define SPEEDUP
 
@@ -264,6 +265,13 @@ static void blitter_done (void)
 #endif
 }
 
+STATIC_INLINE chipmem_agnus_wput2 (uaecptr addr, uae_u32 w)
+{
+#ifndef BLITTER_DEBUG_NO_D
+    chipmem_agnus_wput (addr, w);
+#endif
+}
+
 static void blitter_dofast (void)
 {
     int i,j;
@@ -327,7 +335,8 @@ static void blitter_dofast (void)
                    blt_info.bltcdat = chipmem_agnus_wget (bltcdatptr);
                    bltcdatptr += 2;
                }
-               if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat);
+               if (dodst)
+                   chipmem_agnus_wput2 (dstp, blt_info.bltddat);
                blt_info.bltddat = blit_func (blitahold, blitbhold, blt_info.bltcdat, mt) & 0xFFFF;
                if (blitfill) {
                    uae_u16 d = blt_info.bltddat;
@@ -345,12 +354,17 @@ static void blitter_dofast (void)
                    bltddatptr += 2;
                }
            }
-           if (bltadatptr) bltadatptr += blt_info.bltamod;
-           if (bltbdatptr) bltbdatptr += blt_info.bltbmod;
-           if (bltcdatptr) bltcdatptr += blt_info.bltcmod;
-           if (bltddatptr) bltddatptr += blt_info.bltdmod;
+           if (bltadatptr)
+               bltadatptr += blt_info.bltamod;
+           if (bltbdatptr)
+               bltbdatptr += blt_info.bltbmod;
+           if (bltcdatptr)
+               bltcdatptr += blt_info.bltcmod;
+           if (bltddatptr)
+               bltddatptr += blt_info.bltdmod;
        }
-       if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat);
+       if (dodst)
+           chipmem_agnus_wput2 (dstp, blt_info.bltddat);
        blt_info.bltbhold = blitbhold;
     }
     blit_masktable[0] = 0xFFFF;
@@ -420,7 +434,8 @@ static void blitter_dofast_desc (void)
                    blt_info.bltcdat = blt_info.bltbdat = chipmem_agnus_wget (bltcdatptr);
                    bltcdatptr -= 2;
                }
-               if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat);
+               if (dodst)
+                   chipmem_agnus_wput2 (dstp, blt_info.bltddat);
                blt_info.bltddat = blit_func (blitahold, blitbhold, blt_info.bltcdat, mt) & 0xFFFF;
                if (blitfill) {
                    uae_u16 d = blt_info.bltddat;
@@ -438,12 +453,17 @@ static void blitter_dofast_desc (void)
                    bltddatptr -= 2;
                }
            }
-           if (bltadatptr) bltadatptr -= blt_info.bltamod;
-           if (bltbdatptr) bltbdatptr -= blt_info.bltbmod;
-           if (bltcdatptr) bltcdatptr -= blt_info.bltcmod;
-           if (bltddatptr) bltddatptr -= blt_info.bltdmod;
+           if (bltadatptr)
+               bltadatptr -= blt_info.bltamod;
+           if (bltbdatptr)
+               bltbdatptr -= blt_info.bltbmod;
+           if (bltcdatptr)
+               bltcdatptr -= blt_info.bltcmod;
+           if (bltddatptr)
+               bltddatptr -= blt_info.bltdmod;
        }
-       if (dodst) chipmem_agnus_wput (dstp, blt_info.bltddat);
+       if (dodst)
+           chipmem_agnus_wput2 (dstp, blt_info.bltddat);
        blt_info.bltbhold = blitbhold;
     }
     blit_masktable[0] = 0xFFFF;
@@ -730,7 +750,7 @@ STATIC_INLINE int blitter_doddma (void)
        wd = 1;
     }
     if (wd) {
-       chipmem_agnus_wput (bltdpt, d);
+       chipmem_agnus_wput2 (bltdpt, d);
        bltdpt += blit_add;
        blitter_hcounter2++;
        if (blitter_hcounter2 == blt_info.hblitsize) {
index 05b838e3825700c6f0beafdf9bfb6c2f21212b75..88812de724506a040dc2680e1c0332a131b92b87 100755 (executable)
--- a/cfgfile.c
+++ b/cfgfile.c
@@ -499,6 +499,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write (f, "parallel_autoflush=%d\n", p->parallel_autoflush_time);
 
     cfgfile_dwrite (f, "gfx_display=%d\n", p->gfx_display);
+    cfgfile_dwrite (f, "gfx_display_name=%s\n", p->gfx_display_name);
     cfgfile_dwrite (f, "gfx_framerate=%d\n", p->gfx_framerate);
     cfgfile_dwrite (f, "gfx_width=%d\n", p->gfx_size_win.width); /* compatibility with old versions */
     cfgfile_dwrite (f, "gfx_height=%d\n", p->gfx_size_win.height); /* compatibility with old versions */
@@ -643,6 +644,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
     cfgfile_write (f, "cpu_cycle_exact=%s\n", p->cpu_cycle_exact ? "true" : "false");
     cfgfile_write (f, "blitter_cycle_exact=%s\n", p->blitter_cycle_exact ? "true" : "false");
     cfgfile_write (f, "rtg_nocustom=%s\n", p->picasso96_nocustom ? "true" : "false");
+    cfgfile_write (f, "rtg_modes=0x%x\n", p->picasso96_modeflags);
 
     cfgfile_write (f, "log_illegal_mem=%s\n", p->illegal_mem ? "true" : "false");
     if (p->catweasel >= 100)
@@ -902,6 +904,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
        || cfgfile_string (option, value, "floppy1soundext", p->dfxclickexternal[1], sizeof p->dfxclickexternal[1])
        || cfgfile_string (option, value, "floppy2soundext", p->dfxclickexternal[2], sizeof p->dfxclickexternal[2])
        || cfgfile_string (option, value, "floppy3soundext", p->dfxclickexternal[3], sizeof p->dfxclickexternal[3])
+       || cfgfile_string (option, value, "gfx_display_name", p->gfx_display_name, sizeof p->gfx_display_name)
        || cfgfile_string (option, value, "config_info", p->info, sizeof p->info)
        || cfgfile_string (option, value, "config_description", p->description, sizeof p->description))
            return 1;
@@ -1349,6 +1352,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, char *option, char *valu
        || cfgfile_intval (option, value, "z3mem_start", &p->z3fastmem_start, 1)
        || cfgfile_intval (option, value, "bogomem_size", &p->bogomem_size, 0x40000)
        || cfgfile_intval (option, value, "gfxcard_size", &p->gfxmem_size, 0x100000)
+       || cfgfile_intval (option, value, "rtg_modes", &p->picasso96_modeflags, 1)
        || cfgfile_intval (option, value, "floppy_speed", &p->floppy_speed, 1)
        || cfgfile_intval (option, value, "floppy_write_length", &p->floppy_write_length, 1)
        || cfgfile_intval (option, value, "nr_floppies", &p->nr_floppies, 1)
@@ -2923,8 +2927,8 @@ void default_prefs (struct uae_prefs *p, int type)
     p->cs_resetwarning = 1;
 
     p->gfx_filter = 0;
-    p->gfx_filter_horiz_zoom_mult = 1000;
-    p->gfx_filter_vert_zoom_mult = 1000;
+    p->gfx_filter_horiz_zoom_mult = 0;
+    p->gfx_filter_vert_zoom_mult = 0;
     p->gfx_filter_filtermode = 1;
     p->gfx_filter_scanlineratio = (1 << 4) | 1;
 
index 8e395a9d979cb3ad4fa75acda85fc42137e64283..8715469c64c53a53621a087525c234994bb8d5d8 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -819,9 +819,9 @@ static void compute_toscr_delay_1 (void)
     delay2 += delayoffset;
     delaymask = (fetchwidth - 1) >> toscr_res;
     toscr_delay1x = (delay1 & delaymask) << toscr_res;
-    toscr_delay1x |= shdelay1 >> (2 - toscr_res);
+    toscr_delay1x |= shdelay1 >> (RES_MAX - toscr_res);
     toscr_delay2x = (delay2 & delaymask) << toscr_res;
-    toscr_delay2x |= shdelay2 >> (2 - toscr_res);
+    toscr_delay2x |= shdelay2 >> (RES_MAX - toscr_res);
 }
 
 static void compute_toscr_delay (int hpos)
@@ -1880,23 +1880,38 @@ STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int db
 {
     int j = 0;
     while (datab) {
-       unsigned int tmp = *buf;
        unsigned int col = (datab & 3) << (2 * num);
-       tmp |= col;
-       if ((j & mask) == 0)
+       unsigned coltmp = 0;
+
+       if ((j & mask) == 0) {
+           unsigned int tmp = (*buf) | col;
            *buf++ = tmp;
-       if (dbl > 0)
+           if (do_collisions)
+               coltmp |= tmp;
+       }
+       if (dbl > 0) {
+           unsigned int tmp = (*buf) | col;
            *buf++ = tmp;
+           if (do_collisions)
+               coltmp |= tmp;
+       }
        if (dbl > 1) {
+           unsigned int tmp;
+           tmp = (*buf) | col;
            *buf++ = tmp;
+           if (do_collisions)
+               coltmp |= tmp;
+           tmp = (*buf) | col;
            *buf++ = tmp;
+           if (do_collisions)
+               coltmp |= tmp;
        }
        j++;
        datab >>= 2;
        if (do_collisions) {
-           tmp &= collision_mask;
-           if (tmp) {
-               unsigned int shrunk_tmp = sprite_ab_merge[tmp & 255] | (sprite_ab_merge[tmp >> 8] << 2);
+           coltmp &= collision_mask;
+           if (coltmp) {
+               unsigned int shrunk_tmp = sprite_ab_merge[coltmp & 255] | (sprite_ab_merge[coltmp >> 8] << 2);
                clxdat |= sprclx[shrunk_tmp];
            }
        }
@@ -1909,8 +1924,8 @@ STATIC_INLINE void record_sprite_1 (uae_u16 *buf, uae_u32 datab, int num, int db
    This function assumes that for all sprites in a given line, SPRXP either
    stays equal or increases between successive calls.
 
-   The data is recorded either in lores pixels (if OCS/ECS), or in superhires
-   pixels (if AGA).  */
+   The data is recorded either in lores pixels (if OCS/ECS), or in hires or
+   superhires pixels (if AGA).  */
 
 static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16 *datb, unsigned int ctl)
 {
@@ -1928,14 +1943,14 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
     if (dbl < 0) {
         half = -dbl;
         dbl = 0;
-       if (ecsshres ())
-           mask = 1;
+       if (ecsshres () || (sprite_buffer_res < RES_SUPERHIRES && sprres == RES_SUPERHIRES))
+           mask = 1; /* need to halve horizontal size */
     }
     width = (sprite_width << sprite_buffer_res) >> sprres;
-    attachment =  (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80))));
+    attachment = (spr[num & ~1].armed && ((sprctl[num | 1] & 0x80) || (!(currprefs.chipset_mask & CSMASK_AGA) && (sprctl[num & ~1] & 0x80))));
 
     /* Try to coalesce entries if they aren't too far apart  */
-    if (!next_sprite_forced && e[-1].max + sprite_width >= sprxp && (attachment || ((bplcon4 >> 4) & 15) == ((bplcon4 >> 0) & 15))) {
+    if (!next_sprite_forced && e[-1].max + sprite_width >= sprxp) {
        e--;
     } else {
        next_sprite_entry++;
@@ -1972,7 +1987,6 @@ static void record_sprite (int line, int num, int sprxp, uae_u16 *data, uae_u16
        low order bit records whether the attach bit was set for this pair.  */
     if (attachment) {
        uae_u32 state = 0x01010101 << (num & ~1);
-       uae_u32 *stbuf = spixstate.words + (word_offs >> 2);
        uae_u8 *stb1 = spixstate.bytes + word_offs;
        for (i = 0; i < width; i += 8) {
            stb1[0] |= state;
@@ -3240,13 +3254,13 @@ STATIC_INLINE void SPRxCTLPOS (int num)
     }
 #ifdef AGA
     else if (currprefs.chipset_mask & CSMASK_AGA) {
-       sprxp |= ((sprctl[num] >> 3) & 3) >> (2 - sprite_buffer_res);
+       sprxp |= ((sprctl[num] >> 3) & 3) >> (RES_MAX - sprite_buffer_res);
        s->dblscan = sprpos[num] & 0x80;
     }
 #endif
 #ifdef ECS_DENISE
     else if (currprefs.chipset_mask & CSMASK_ECS_DENISE) {
-       sprxp |= ((sprctl[num] >> 3) & 2) >> (2 - sprite_buffer_res);
+       sprxp |= ((sprctl[num] >> 3) & 2) >> (RES_MAX - sprite_buffer_res);
     }
 #endif
     s->xpos = sprxp;
@@ -4289,9 +4303,7 @@ static void vsync_handler (void)
        lof ^= 0x8000;
 
 #ifdef PICASSO96
-    /* And now let's update the Picasso palette, if required */
-    if (picasso_on)
-       picasso_handle_vsync ();
+    picasso_handle_vsync ();
 #endif
 
     if (quit_program > 0) {
@@ -4821,9 +4833,6 @@ void customreset (int hardreset)
 
     bogusframe = 1;
 
-    sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES;
-    if (sprite_buffer_res > currprefs.gfx_resolution)
-       sprite_buffer_res = currprefs.gfx_resolution;
     if (savestate_state == STATE_RESTORE) {
        uae_u16 v;
        uae_u32 vv;
index 123c6aa110a0fb14c62f10bc9ee0db0dba2aa273..759ec301d97d30a2a56ad9632e9e8761559037c9 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -1031,6 +1031,7 @@ STATIC_INLINE void draw_sprites_2 (struct sprite_entry *e, int ham, int dualpf,
     stbuf -= e->pos;
 
     window_pos = e->pos + ((DIW_DDF_OFFSET - DISPLAY_LEFT_SHIFT) << sprite_buffer_res);
+
     spr_level = 0;
     spr_level_max = 0;
     if (res_shift > 0 && aga) {
@@ -1043,10 +1044,12 @@ STATIC_INLINE void draw_sprites_2 (struct sprite_entry *e, int ham, int dualpf,
     else if (posdoubling)
        window_pos <<= posdoubling;
     window_pos += pixels_offset;
+
     if (aga) {
        if (window_pos < sprite_aga_first_x)
            sprite_aga_first_x = window_pos;
     }
+
     for (pos = e->pos; pos < e->max; pos += 1 << sizeskip) {
        int maskshift, plfmask;
        unsigned int v = buf[pos];
@@ -1998,7 +2001,7 @@ static void center_image (void)
            visible_left_border = (max_diwlastword - 48) / 2 - gfxvidinfo.width;
     }
     if (currprefs.gfx_xcenter_pos >= 0) {
-       int val = currprefs.gfx_xcenter_pos < 56 ? 56 : currprefs.gfx_xcenter_pos;
+       int val = (currprefs.gfx_xcenter_pos >> RES_MAX) < 56 ? 56 : (currprefs.gfx_xcenter_pos >> RES_MAX);
        visible_left_border = val + (DIW_DDF_OFFSET << currprefs.gfx_resolution) - (DISPLAY_LEFT_SHIFT * 2 - (DISPLAY_LEFT_SHIFT << currprefs.gfx_resolution));
     }
 
@@ -2032,7 +2035,7 @@ static void center_image (void)
        }
     }
     if (currprefs.gfx_ycenter_pos >= 0) {
-       thisframe_y_adjust = currprefs.gfx_ycenter_pos;
+       thisframe_y_adjust = currprefs.gfx_ycenter_pos >> 1;
        if (thisframe_y_adjust + max_drawn_amiga_line > 2 * maxvpos_max)
            thisframe_y_adjust = 2 * maxvpos_max - max_drawn_amiga_line;
        if (thisframe_y_adjust < 0)
@@ -2736,6 +2739,10 @@ void reset_drawing (void)
     notice_screen_contents_lost ();
     frame_res_cnt = FRAMES_UNTIL_RES_SWITCH;
     lightpen_y1 = lightpen_y2 = -1;
+
+    sprite_buffer_res = (currprefs.chipset_mask & CSMASK_AGA) ? RES_SUPERHIRES : RES_LORES;
+    if (sprite_buffer_res > currprefs.gfx_resolution)
+       sprite_buffer_res = currprefs.gfx_resolution;
 }
 
 void drawing_init (void)
index 395df6d5c119d17734beef9699972eeafe51779c..4b3db836f287e11096027f10598e642c11843b05 100755 (executable)
@@ -27,6 +27,8 @@
 #include "ncr_scsi.h"
 #include "debug.h"
 
+static int scrambled_autoconfig = 0;
+
 #define MAX_EXPANSION_BOARDS 8
 
 /* ********************************************************** */
@@ -1173,7 +1175,10 @@ void expamem_reset (void)
     int cardno = 0;
     ecard = 0;
 
-    uae_id = hackers_id;
+    if (scrambled_autoconfig)
+       uae_id = rand () & 2047 + 100;
+    else
+       uae_id = hackers_id;
 
     allocate_expamem ();
 
index b230da5a287d42bdf4a21dc3dfcdb981eda98863..357748f9a0494de62f7ad8ca4989613c216db510 100755 (executable)
--- a/gfxutil.c
+++ b/gfxutil.c
@@ -10,6 +10,7 @@
 #include "sysdeps.h"
 #include "options.h"
 #include "custom.h"
+#include "rtgmodes.h"
 #include "xwin.h"
 #include "gfxfilter.h"
 
@@ -90,7 +91,7 @@ static unsigned int doAlpha (int alpha, int bits, int shift)
     return (alpha & ((1 << bits) - 1)) << shift;
 }
 
-static float video_gamma(float value, float gamma, float bri, float con)
+static float video_gamma (float value, float gamma, float bri, float con)
 {
     double factor;
     float ret;
@@ -113,7 +114,7 @@ static float video_gamma(float value, float gamma, float bri, float con)
 static uae_u32 gamma[256 * 3];
 static int lf, hf;
 
-static void video_calc_gammatable(void)
+static void video_calc_gammatable (void)
 {
     int i;
     float bri, con, gam, v;
@@ -141,7 +142,7 @@ static void video_calc_gammatable(void)
     }
 }
 
-static uae_u32 limit256(double v)
+static uae_u32 limit256 (double v)
 {
     v = v * (double)(currprefs.gfx_filter_contrast + 1000) / 1000.0 + currprefs.gfx_filter_luminance / 10.0;
     if (v < 0)
@@ -150,7 +151,7 @@ static uae_u32 limit256(double v)
        v = 255;
     return ((uae_u32)v) & 0xff;
 }
-static uae_u32 limit256rb(double v)
+static uae_u32 limit256rb (double v)
 {
     v *= (double)(currprefs.gfx_filter_saturation + 1000) / 1000.0;
     if (v < -128)
@@ -159,25 +160,25 @@ static uae_u32 limit256rb(double v)
        v = 127;
     return ((uae_u32)v) & 0xff;
 }
-static double get_y(int r, int g, int b)
+static double get_y (int r, int g, int b)
 {
-    return 0.2989f*r + 0.5866f*g + 0.1145f*b;
+    return 0.2989f * r + 0.5866f * g + 0.1145f * b;
 }
-static uae_u32 get_yh(int r, int g, int b)
+static uae_u32 get_yh (int r, int g, int b)
 {
-    return limit256(get_y(r, g, b) * hf / 256);
+    return limit256 (get_y (r, g, b) * hf / 256);
 }
-static uae_u32 get_yl(int r, int g, int b)
+static uae_u32 get_yl (int r, int g, int b)
 {
-    return limit256(get_y(r, g, b) * lf / 256);
+    return limit256 (get_y (r, g, b) * lf / 256);
 }
-static uae_u32 get_cb(int r, int g, int b)
+static uae_u32 get_cb (int r, int g, int b)
 {
-    return limit256rb(-0.168736f*r - 0.331264f*g + 0.5f*b);
+    return limit256rb (-0.168736f * r - 0.331264f * g + 0.5f * b);
 }
-static uae_u32 get_cr(int r, int g, int b)
+static uae_u32 get_cr (int r, int g, int b)
 {
-    return limit256rb(0.5f*r - 0.418688f*g - 0.081312f*b);
+    return limit256rb (0.5f * r - 0.418688f * g - 0.081312f * b);
 }
 
 extern uae_s32 tyhrgb[65536];
@@ -186,23 +187,92 @@ extern uae_s32 tcbrgb[65536];
 extern uae_s32 tcrrgb[65536];
 extern uae_u32 redc[3 * 256], grec[3 * 256], bluc[3 * 256];
 
-static uae_u32 lowbits(int v, int shift, int lsize)
+static uae_u32 lowbits (int v, int shift, int lsize)
 {
     v >>= shift;
     v &= (1 << lsize) - 1;
     return v;
 }
 
-void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap)
+void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt)
 {
+    int byte_swap = 0;
     int i;
+    int red_bits = 0, green_bits, blue_bits;
+    int red_shift, green_shift, blue_shift;
 
-    for (i = 0; i < 65536; i++) {
-        uae_u32 r, g, b;
-        r = (((i >> 11) & 31) << 3) | lowbits (i, 11, 3);
-        g = (((i >>  5) & 63) << 2) | lowbits (i,  5, 2);
-        b = (((i >>  0) & 31) << 3) | lowbits (i,  0, 3);
-       p96_rgbx16[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs);
+    int bpp = rw + gw + bw;
+
+    switch (rgbfmt)
+    {
+       case RGBFB_R5G6B5PC:
+       red_bits = 5;
+       green_bits = 6;
+       blue_bits = 5;
+       red_shift = 11;
+       green_shift = 5;
+       blue_shift = 0;
+       break;
+       case RGBFB_R5G5B5PC:
+       red_bits = green_bits = blue_bits = 5;
+       red_shift = 10;
+       green_shift = 5;
+       blue_shift = 0;
+       break;
+       case RGBFB_R5G6B5:
+       red_bits = 5;
+       green_bits = 6;
+       blue_bits = 5;
+       red_shift = 11;
+       green_shift = 5;
+       blue_shift = 0;
+       byte_swap = 1;
+       break;
+       case RGBFB_R5G5B5:
+       red_bits = green_bits = blue_bits = 5;
+       red_shift = 10;
+       green_shift = 5;
+       blue_shift = 0;
+       byte_swap = 1;
+       break;
+       case RGBFB_B5G6R5PC:
+       red_bits = 5;
+       green_bits = 6;
+       blue_bits = 5;
+       red_shift = 0;
+       green_shift = 5;
+       blue_shift = 11;
+       break;
+       case RGBFB_B5G5R5PC:
+       red_bits = 5;
+       green_bits = 5;
+       blue_bits = 5;
+       red_shift = 0;
+       green_shift = 5;
+       blue_shift = 10;
+       break;
+    }
+
+    memset (p96_rgbx16, 0, sizeof p96_rgbx16);
+
+    if (red_bits) {
+       int lrbits = 8 - red_bits;
+       int lgbits = 8 - green_bits;
+       int lbbits = 8 - blue_bits;
+       int lrmask = (1 << red_bits) - 1;
+       int lgmask = (1 << green_bits) - 1;
+       int lbmask = (1 << blue_bits) - 1;
+       for (i = 65535; i >= 0; i--) {
+           uae_u32 r, g, b, c;
+           uae_u32 j = byte_swap ? bswap_16 (i) : i;
+           r = (((j >>   red_shift) & lrmask) << lrbits) | lowbits (j,   red_shift, lrbits);
+           g = (((j >> green_shift) & lgmask) << lgbits) | lowbits (j, green_shift, lgbits);
+           b = (((j >>  blue_shift) & lbmask) << lbbits) | lowbits (j,  blue_shift, lbbits);
+           c = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs);
+           if (bpp <= 16)
+               c |= c * 0x00010001;
+           p96_rgbx16[i] = c;
+       }
     }
 }
 
index 984a6ea5820f4df135637f9ab5346a2becd3c4aa..bd6d96d11d6bd75b82fc5bb5ba7efa6347fee58c 100755 (executable)
@@ -160,6 +160,7 @@ extern int bpl_off[8];
 #define RES_LORES 0
 #define RES_HIRES 1
 #define RES_SUPERHIRES 2
+#define RES_MAX 2
 
 /* calculate shift depending on resolution (replaced "decided_hires ? 4 : 8") */
 #define RES_SHIFT(res) ((res) == RES_LORES ? 8 : (res) == RES_HIRES ? 4 : 2)
index 843e7b3251518e6191cc77e16cca5b06480f0e1e..1cf5e7e7dd1aeced292cea5661b4a440eb5c4499 100755 (executable)
@@ -91,6 +91,7 @@ extern void mousehack_handle (int sprctl, int sprpos);
 extern void togglemouse (void);
 extern int mousehack_alive (void);
 extern int mousehack_allowed (void);
+extern int magicmouse_alive (void);
 
 extern void setmousebuttonstateall (int mouse, uae_u32 buttonbits, uae_u32 buttonmask);
 extern void setjoybuttonstateall (int joy, uae_u32 buttonbits, uae_u32 buttonmask);
index bd303c8db4e97aed7cfaead5cb2f69e2eccf4474..d1d4841d7f47f32c9d2ecead6ba451b10eeefaa9 100755 (executable)
@@ -150,6 +150,7 @@ struct uae_prefs {
     uae_u32 override_dga_address;
 
     int gfx_display;
+    char gfx_display_name[256];
     int gfx_framerate, gfx_autoframerate;
     struct wh gfx_size_win;
     struct wh gfx_size_fs;
@@ -260,6 +261,7 @@ struct uae_prefs {
     int cpu_compatible;
     int address_space_24;
     int picasso96_nocustom;
+    int picasso96_modeflags;
 
     uae_u32 z3fastmem_size;
     uae_u32 z3fastmem_start;
diff --git a/include/rtgmodes.h b/include/rtgmodes.h
new file mode 100755 (executable)
index 0000000..41818fb
--- /dev/null
@@ -0,0 +1,65 @@
+/* Types for RGBFormat used */
+typedef enum {
+    RGBFB_NONE,                /* no valid RGB format (should not happen) */
+    RGBFB_CLUT,                /* palette mode, set colors when opening screen using
+                          tags or use SetRGB32/LoadRGB32(...) */
+    RGBFB_R8G8B8,      /* TrueColor RGB (8 bit each) */
+    RGBFB_B8G8R8,      /* TrueColor BGR (8 bit each) */
+    RGBFB_R5G6B5PC,    /* HiColor16 (5 bit R, 6 bit G, 5 bit B),
+                          format: gggbbbbbrrrrrggg */
+    RGBFB_R5G5B5PC,    /* HiColor15 (5 bit each), format: gggbbbbb0rrrrrgg */
+    RGBFB_A8R8G8B8,    /* 4 Byte TrueColor ARGB (A unused alpha channel) */
+    RGBFB_A8B8G8R8,    /* 4 Byte TrueColor ABGR (A unused alpha channel) */
+    RGBFB_R8G8B8A8,    /* 4 Byte TrueColor RGBA (A unused alpha channel) */
+    RGBFB_B8G8R8A8,    /* 4 Byte TrueColor BGRA (A unused alpha channel) */
+    RGBFB_R5G6B5,      /* HiColor16 (5 bit R, 6 bit G, 5 bit B),
+                          format: rrrrrggggggbbbbb */
+    RGBFB_R5G5B5,      /* HiColor15 (5 bit each), format: 0rrrrrgggggbbbbb */
+    RGBFB_B5G6R5PC,    /* HiColor16 (5 bit R, 6 bit G, 5 bit B),
+                          format: gggrrrrrbbbbbggg */
+    RGBFB_B5G5R5PC,    /* HiColor15 (5 bit each), format: gggrrrrr0bbbbbbgg */
+
+    /* By now, the following formats are for use with a hardware window only
+       (bitmap operations may be implemented incompletely) */
+
+    RGBFB_Y4U2V2,      /* 2 Byte TrueColor YUV (CCIR recommendation CCIR601).
+                          Each two-pixel unit is stored as one longword
+                          containing luminance (Y) for each of the two pixels,
+                          and chrominance (U,V) for alternate pixels.
+                          The missing chrominance values are generated by
+                          interpolation. (Y1-U0-Y0-V0) */
+    RGBFB_Y4U1V1,      /* 1 Byte TrueColor ACCUPAK. Four adjacent pixels form
+                          a packet of 5 bits Y (luminance) each pixel and 6 bits
+                          U and V (chrominance) shared by the four pixels */
+
+    RGBFB_MaxFormats
+} RGBFTYPE;
+
+#define RGBFF_NONE     (1<<RGBFB_NONE)
+#define RGBFF_CLUT     (1<<RGBFB_CLUT)
+#define RGBFF_R8G8B8   (1<<RGBFB_R8G8B8)
+#define RGBFF_B8G8R8   (1<<RGBFB_B8G8R8)
+#define RGBFF_R5G6B5PC (1<<RGBFB_R5G6B5PC)
+#define RGBFF_R5G5B5PC (1<<RGBFB_R5G5B5PC)
+#define RGBFF_A8R8G8B8 (1<<RGBFB_A8R8G8B8)
+#define RGBFF_A8B8G8R8 (1<<RGBFB_A8B8G8R8)
+#define RGBFF_R8G8B8A8 (1<<RGBFB_R8G8B8A8)
+#define RGBFF_B8G8R8A8 (1<<RGBFB_B8G8R8A8)
+#define RGBFF_R5G6B5   (1<<RGBFB_R5G6B5)
+#define RGBFF_R5G5B5   (1<<RGBFB_R5G5B5)
+#define RGBFF_B5G6R5PC (1<<RGBFB_B5G6R5PC)
+#define RGBFF_B5G5R5PC (1<<RGBFB_B5G5R5PC)
+#define RGBFF_Y4U2V2   (1<<RGBFB_Y4U2V2)
+#define RGBFF_Y4U1V1   (1<<RGBFB_Y4U1V1)
+
+#define RGBMASK_8BIT RGBFF_CLUT
+#define RGBMASK_16BIT (RGBFF_R5G6B5PC | RGBFF_B5G6R5PC | RGBFF_R5G6B5)
+#define RGBMASK_15BIT (RGBFF_R5G5B5PC | RGBFF_B5G5R5PC | RGBFF_R5G5B5)
+#define RGBMASK_24BIT (RGBFF_R8G8B8 | RGBFF_B8G8R8)
+#define RGBMASK_32BIT (RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8)
+
+#define        RGBFF_PLANAR    RGBFF_NONE
+#define        RGBFF_CHUNKY    RGBFF_CLUT
+
+#define        RGBFB_PLANAR    RGBFB_NONE
+#define        RGBFB_CHUNKY    RGBFB_CLUT
index ab0c5cba7586664329c8f094334459520a623df2..4cf99e16dbba140ea9b8231a0aa70e6ad09088d5 100755 (executable)
@@ -45,7 +45,7 @@ extern void alloc_colors256 (int (*)(int, int, int, xcolnr *));
 extern void alloc_colors64k (int, int, int, int, int, int, int, int, int, int);
 extern void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap,
                              uae_u32 *rc, uae_u32 *gc, uae_u32 *bc);
-extern void alloc_colors_picasso (int, int, int, int, int, int, int, int, int, int);
+extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt);
 extern void setup_greydither (int bits, allocfunc_type allocfunc);
 extern void setup_greydither_maxcol (int maxcol, allocfunc_type allocfunc);
 extern void setup_dither (int bits, allocfunc_type allocfunc);
@@ -93,3 +93,4 @@ extern struct vidbuf_description gfxvidinfo;
 /* For ports using tui.c, this should be built by graphics_setup(). */
 extern struct bstring *video_mode_menu;
 extern void vidmode_menu_selected(int);
+
index 398ee0ad85a00d58fbc8f5e30f6ae47ffd4c1a34..43bccef0d3712a32fc9675d88acf43c0de3cd382 100755 (executable)
@@ -799,7 +799,7 @@ void read_inputdevice_config (struct uae_prefs *pr, char *option, char *value)
     xfree (custom);
 }
 
-static int ievent_alive = 0;
+static int ievent_alive, mouseedge_alive;
 static int lastmx, lastmy;
 static uae_u32 magicmouse_ibase = 0;
 #define intui "intuition.library"
@@ -846,7 +846,7 @@ static void mousehack_enable (void)
     rtarea[off + 12 - 2] = 1;
 }
 
-static void mousehack_setpos(int mousexpos, int mouseypos)
+static void mousehack_setpos (int mousexpos, int mouseypos)
 {
     uae_u8 *p;
     if (!uae_boot_rom)
@@ -863,16 +863,16 @@ static int mouseedge_x, mouseedge_y, mouseedge_time;
 #define MOUSEEDGE_RANGE 300
 #define MOUSEEDGE_TIME 2
 
-void setamigamouse(int x, int y)
+void setamigamouse (int x, int y)
 {
-    mousehack_enable();
-    mousehack_setpos(x, y);
+    mousehack_enable ();
+    mousehack_setpos (x, y);
 }
 
-extern void setmouseactivexy(int,int,int);
-extern void drawing_adjust_mousepos(int*,int*);
+extern void setmouseactivexy (int,int,int);
+extern void drawing_adjust_mousepos (int*,int*);
 
-static void mouseedge(void)
+static int mouseedge (void)
 {
     int x, y, dir;
     uaecptr ib;
@@ -880,7 +880,7 @@ static void mouseedge(void)
     static int isnonzero;
 
     if (!currprefs.win32_outsidemouse || magicmouse_ibase == 0xffffffff)
-       return;
+       return 0;
     dir = 0;
     if (!mouseedge_time) {
        isnonzero = 0;
@@ -891,14 +891,13 @@ static void mouseedge(void)
     else
        ib = magicmouse_ibase;
     if (!ib)
-       return;
+       return 0;
     x = get_word (ib + 70);
     y = get_word (ib + 68);
     if (x || y)
        isnonzero = 1;
-    //write_log ("%x x %d\n", x, y);
     if (!isnonzero)
-       return;
+       return 0;
     if (melast_x == x) {
        if (mouseedge_x < -MOUSEEDGE_RANGE) {
            mouseedge_x = 0;
@@ -929,20 +928,20 @@ static void mouseedge(void)
        mouseedge_y = 0;
        melast_y = y;
     }
-    return;
+    return 1;
 
 end:
     mouseedge_time = 0;
     if (dir) {
        if (!picasso_on) {
-           drawing_adjust_mousepos(&x, &y);
+           drawing_adjust_mousepos (&x, &y);
        }
-       //write_log ("%d\n", dir);
        if (!dmaen(DMA_SPRITE))
-           setmouseactivexy(x, y, 0);
+           setmouseactivexy (x, y, 0);
        else
-           setmouseactivexy(x, y, dir);
+           setmouseactivexy (x, y, dir);
     }
+    return 1;
 }
 
 int mousehack_alive (void)
@@ -950,11 +949,16 @@ int mousehack_alive (void)
     return ievent_alive > 0;
 }
 
+int magicmouse_alive (void)
+{
+    return mouseedge_alive > 0;
+}
+
 static void mousehack_helper (void)
 {
     int mousexpos, mouseypos;
 
-    if (!mousehack_allowed())
+    if (!mousehack_allowed ())
        return;
 #ifdef PICASSO96
     if (picasso_on) {
@@ -963,10 +967,10 @@ static void mousehack_helper (void)
     } else
 #endif
     {
-       mouseypos = coord_native_to_amiga_y (lastmy) << 1;
        mousexpos = coord_native_to_amiga_x (lastmx);
+       mouseypos = coord_native_to_amiga_y (lastmy) << 1;
     }
-    mousehack_setpos(mousexpos, mouseypos);
+    mousehack_setpos (mousexpos, mouseypos);
 }
 
 STATIC_INLINE int adjust (int val)
@@ -1932,11 +1936,14 @@ void inputdevice_vsync (void)
     inputdevice_handle_inputcode ();
     if (ievent_alive > 0)
        ievent_alive--;
+    if (mouseedge_alive > 0)
+       mouseedge_alive--;
 #ifdef ARCADIA
     if (arcadia_bios)
        arcadia_vsync ();
 #endif
-    mouseedge();
+    if (mouseedge ())
+       mouseedge_alive = 10;
 }
 
 void inputdevice_reset (void)
@@ -3206,7 +3213,7 @@ void setmousestate (int mouse, int axis, int data, int isabs)
     }
     for (i = 0; i < MAX_INPUT_SUB_EVENT; i++)
        handle_input_event (id->eventid[ID_AXIS_OFFSET + axis][i], v, 0, 0);
-    mousehack_helper();
+    mousehack_helper ();
 }
 int getmousestate(int joy)
 {
index 4b12931b1d8af9c5e70e27f1536b4e0b163ac26f..9ed8a0b0f76ce52d1e075474f05b747d9ce89b7f 100755 (executable)
--- a/memory.c
+++ b/memory.c
@@ -814,7 +814,7 @@ struct romdata *getromdatabyidgroup (int id, int group, int subitem)
     return 0;
 }
 
-STATIC_INLINE int notcrc32(uae_u32 crc32)
+STATIC_INLINE int notcrc32 (uae_u32 crc32)
 {
     if (crc32 == 0xffffffff || crc32 == 0x00000000)
        return 1;
@@ -832,7 +832,7 @@ struct romdata *getromdatabycrc (uae_u32 crc32)
     return 0;
 }
 
-static int cmpsha1(uae_u8 *s1, struct romdata *rd)
+static int cmpsha1 (uae_u8 *s1, struct romdata *rd)
 {
     int i;
 
@@ -846,7 +846,7 @@ static int cmpsha1(uae_u8 *s1, struct romdata *rd)
     return 0;
 }
 
-static struct romdata *checkromdata(uae_u8 *sha1, int size, uae_u32 mask)
+static struct romdata *checkromdata (uae_u8 *sha1, int size, uae_u32 mask)
 {
     int i = 0;
     while (roms[i].name) {
@@ -941,7 +941,7 @@ void getromname     (struct romdata *rd, char *name)
        sprintf (name + strlen (name), " [%s]", rd->partnumber);
 }
 
-struct romlist *getromlistbyromdata(struct romdata *rd)
+struct romlist *getromlistbyromdata (struct romdata *rd)
 {
     int ids[2];
 
@@ -950,7 +950,7 @@ struct romlist *getromlistbyromdata(struct romdata *rd)
     return getromlistbyids(ids);
 }
 
-struct romlist *getromlistbyids(int *ids)
+struct romlist *getromlistbyids (int *ids)
 {
     struct romdata *rd;
     int i, j;
@@ -969,7 +969,7 @@ struct romlist *getromlistbyids(int *ids)
     return NULL;
 }
 
-void romwarning(int *ids)
+void romwarning (int *ids)
 {
     int i, exp;
     char tmp1[MAX_DPATH], tmp2[MAX_DPATH];
@@ -1029,7 +1029,7 @@ __inline__ void byteput (uaecptr addr, uae_u32 b)
 }
 #endif
 
-int addr_valid(char *txt, uaecptr addr, uae_u32 len)
+int addr_valid (char *txt, uaecptr addr, uae_u32 len)
 {
     addrbank *ab = &get_mem_bank(addr);
     if (ab == 0 || !(ab->flags & ABFLAG_RAM) || addr < 0x100 || len < 0 || len > 16777215 || !valid_address (addr, len)) {
@@ -1058,7 +1058,7 @@ static int REGPARAM3 dummy_check (uaecptr addr, uae_u32 size) REGPARAM;
 #define NONEXISTINGDATA 0
 //#define NONEXISTINGDATA 0xffffffff
 
-static void dummylog(int rw, uaecptr addr, int size, uae_u32 val, int ins)
+static void dummylog (int rw, uaecptr addr, int size, uae_u32 val, int ins)
 {
     if (illegal_count >= MAX_ILG)
        return;
@@ -2265,8 +2265,8 @@ void a3000_fakekick (int map)
                        extendedkickmem_mask = extendedkickmem_size - 1;
                        extendedkickmemory = mapped_malloc (extendedkickmem_size, "rom_f0");
                        extendedkickmem_bank.baseaddr = extendedkickmemory;
-                       memcpy(extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536);
-                       map_banks(&extendedkickmem_bank, 0xf0, 1, 1);
+                       memcpy (extendedkickmemory, fkickmemory + fkickmem_size / 2, 65536);
+                       map_banks (&extendedkickmem_bank, 0xf0, 1, 1);
                        f0 = 1;
                    } else {
                        write_log ("A3000 Bonus hack: can't map bonus when uae boot rom is enabled\n");
@@ -2278,7 +2278,7 @@ void a3000_fakekick (int map)
        }
     } else {
        if (f0) {
-           map_banks(&dummy_bank, 0xf0, 1, 1);
+           map_banks (&dummy_bank, 0xf0, 1, 1);
            mapped_free(extendedkickmemory);
            extendedkickmemory = NULL;
            f0 = 0;
@@ -2658,7 +2658,7 @@ static int patch_residents (uae_u8 *kickmemory, int size)
     return patched;
 }
 
-static void patch_kick(void)
+static void patch_kick (void)
 {
     int patched = 0;
     if (kickmem_size >= 524288 && currprefs.kickshifter)
@@ -2810,7 +2810,7 @@ void mapped_free (uae_u8 *p)
 
 shmpiece *shm_start;
 
-static void dumplist(void)
+static void dumplist (void)
 {
     shmpiece *x = shm_start;
     write_log ("Start Dump:\n");
@@ -2952,6 +2952,7 @@ uae_u8 *mapped_malloc (size_t s, char *file)
 static void init_mem_banks (void)
 {
     int i;
+
     for (i = 0; i < MEMORY_BANKS; i++)
        put_mem_bank (i << 16, &dummy_bank, 0);
 #ifdef NATMEM_OFFSET
index 1e297c92252d3541c827eb04d6485356cb9c6998..b499e61dfc9070421338df7fedaee617ecbccc17 100755 (executable)
@@ -33,7 +33,6 @@
 #include "newcpu.h"
 #include "traps.h"
 #include "od-win32/win32.h"
-#include "picasso96_win.h"
 #include "sounddep/sound.h"
 #include "dxwrap.h"
 #include "win32.h"
index 3e0c18d79b4a2d177d36f469a0db44ee983d8428..cf55ff65b86892b4bbd76cc0d39a8e2b9b630e1d 100755 (executable)
@@ -161,13 +161,14 @@ BOOL RPSendMessage(UINT uMessage, WPARAM wParam, LPARAM lParam,
                cds.dwData = (ULONG_PTR)uMessage;
                cds.cbData = dwDataSize;
                cds.lpData = (LPVOID)pData;
-               if (!SendMessageTimeout(pInfo->hHostMessageWindow, WM_COPYDATA, (WPARAM)pInfo->hGuestMessageWindow, (LPARAM)&cds, SMTO_NORMAL, SRPMSG_TIMEOUT, &dwResult))
-                       return FALSE;
+               dwResult = SendMessage(pInfo->hHostMessageWindow, WM_COPYDATA, (WPARAM)pInfo->hGuestMessageWindow, (LPARAM)&cds);
        }
        else
        {
-               if (!SendMessageTimeout(pInfo->hHostMessageWindow, uMessage, wParam, lParam, SMTO_NORMAL, SRPMSG_TIMEOUT, &dwResult))
-                       return FALSE;
+               // SendMessageTimeout is not used, since the host
+               // might display MessageBoxes during notifications
+               // (e.g. go-to-fullscreen message)
+               dwResult = SendMessage(pInfo->hHostMessageWindow, uMessage, wParam, lParam);
        }
        if (plResult)
                *plResult = dwResult;
index 7ccaf461990744cecc6533bf195f6ca7f661d635..e1c1a5167fbd892ca369853fc32ff8641c1b3d90 100755 (executable)
@@ -7,7 +7,7 @@
          : License version 2 as published by the Free Software Foundation.
  Authors : os, mcb
  Created : 2007-08-27 13:55:49
- Updated : 2008-02-03 06:49:00
+ Updated : 2008-03-25 18:49:00
  Comment : RP Player interprocess communication include file
  *****************************************************************************/
 
 //  Guest-to-Host Messages
 // ****************************************************************************
 
-#define RPIPCGM_REGISTER       (WM_APP + 0)
-#define RPIPCGM_FEATURES       (WM_APP + 1)
-#define RPIPCGM_CLOSED (WM_APP + 2)
-#define RPIPCGM_ACTIVATED      (WM_APP + 3)
-#define RPIPCGM_DEACTIVATED    (WM_APP + 4)
-#define RPIPCGM_SCREENMODE     (WM_APP + 9)
-#define RPIPCGM_POWERLED       (WM_APP + 10)
-#define RPIPCGM_DEVICES        (WM_APP + 11)
-#define RPIPCGM_DEVICEACTIVITY (WM_APP + 12)
-#define RPIPCGM_MOUSECAPTURE   (WM_APP + 13)
-#define RPIPCGM_HOSTAPIVERSION (WM_APP + 14)
-#define RPIPCGM_PAUSE  (WM_APP + 15)
-#define RPIPCGM_DEVICECONTENT  (WM_APP + 16)
-#define RPIPCGM_TURBO  (WM_APP + 17)
-#define RPIPCGM_PING   (WM_APP + 18)
-#define RPIPCGM_VOLUME (WM_APP + 19)
-#define RPIPCGM_ESCAPED        (WM_APP + 20)
-#define RPIPCGM_PARENT (WM_APP + 21)
+#define RPIPCGM_REGISTER        (WM_APP + 0)
+#define RPIPCGM_FEATURES        (WM_APP + 1)
+#define RPIPCGM_CLOSED          (WM_APP + 2)
+#define RPIPCGM_ACTIVATED       (WM_APP + 3)
+#define RPIPCGM_DEACTIVATED     (WM_APP + 4)
+#define RPIPCGM_SCREENMODE      (WM_APP + 9)
+#define RPIPCGM_POWERLED        (WM_APP + 10)
+#define RPIPCGM_DEVICES         (WM_APP + 11)
+#define RPIPCGM_DEVICEACTIVITY  (WM_APP + 12)
+#define RPIPCGM_MOUSECAPTURE    (WM_APP + 13)
+#define RPIPCGM_HOSTAPIVERSION  (WM_APP + 14)
+#define RPIPCGM_PAUSE           (WM_APP + 15)
+#define RPIPCGM_DEVICECONTENT   (WM_APP + 16)
+#define RPIPCGM_TURBO           (WM_APP + 17)
+#define RPIPCGM_PING            (WM_APP + 18)
+#define RPIPCGM_VOLUME          (WM_APP + 19)
+#define RPIPCGM_ESCAPED         (WM_APP + 20)
+#define RPIPCGM_PARENT          (WM_APP + 21)
+#define RPIPCGM_DEVICESEEK      (WM_APP + 22)
 
 
 // ****************************************************************************
 //  Host-to-Guest Messages
 // ****************************************************************************
 
-#define RPIPCHM_CLOSE  (WM_APP + 200)
-#define RPIPCHM_SCREENMODE     (WM_APP + 202)
-#define RPIPCHM_SCREENCAPTURE  (WM_APP + 203)
-#define RPIPCHM_PAUSE  (WM_APP + 204)
-#define RPIPCHM_DEVICECONTENT  (WM_APP + 205)
-#define RPIPCHM_RESET  (WM_APP + 206)
-#define RPIPCHM_TURBO  (WM_APP + 207)
-#define RPIPCHM_PING   (WM_APP + 208)
-#define RPIPCHM_VOLUME (WM_APP + 209)
-#define RPIPCHM_ESCAPEKEY      (WM_APP + 210)
-#define RPIPCHM_EVENT  (WM_APP + 211)
-#define RPIPCHM_MOUSECAPTURE   (WM_APP + 212)
+#define RPIPCHM_CLOSE          (WM_APP + 200)
+#define RPIPCHM_SCREENMODE     (WM_APP + 202)
+#define RPIPCHM_SCREENCAPTURE  (WM_APP + 203)
+#define RPIPCHM_PAUSE          (WM_APP + 204)
+#define RPIPCHM_DEVICECONTENT  (WM_APP + 205)
+#define RPIPCHM_RESET          (WM_APP + 206)
+#define RPIPCHM_TURBO          (WM_APP + 207)
+#define RPIPCHM_PING           (WM_APP + 208)
+#define RPIPCHM_VOLUME         (WM_APP + 209)
+#define RPIPCHM_ESCAPEKEY      (WM_APP + 210)
+#define RPIPCHM_EVENT          (WM_APP + 211)
+#define RPIPCHM_MOUSECAPTURE   (WM_APP + 212)
+#define RPIPCHM_SCREENCLIP     (WM_APP + 213)
 
 
 // ****************************************************************************
@@ -80,6 +82,7 @@
 #define RP_FEATURE_PAUSE         0x00000040 // pause functionality is available (see RPIPCHM_PAUSE message)
 #define RP_FEATURE_TURBO         0x00000080 // turbo mode functionality is available (see RPIPCHM_TURBO message)
 #define RP_FEATURE_VOLUME        0x00000100 // volume adjustment is possible (see RPIPCHM_VOLUME message)
+#define RP_FEATURE_SCREENCLIP    0x00000200 // screen clipping is supported (see RPIPCHM_SCREENCLIP message)
 
 // Screen Modes
 #define RP_SCREENMODE_1X          0 // 1x windowed mode
@@ -127,5 +130,16 @@ typedef struct RPDeviceContent
 #define RP_RESET_SOFT  0 // soft reset
 #define RP_RESET_HARD  1 // hard reset
 
+// RPIPCGM_MOUSECAPTURE/RPIPCHM_MOUSECAPTURE
+#define RP_MOUSECAPTURE_CAPTURED     0x00000001
+#define RP_MOUSECAPTURE_MAGICMOUSE   0x00000002
+
+typedef struct RPScreenClip
+{
+       LONG lLeft;
+       LONG lTop;
+       LONG lWidth;
+       LONG lHeight;
+} RPSCREENCLIP;
 
 #endif // __CLOANTO_RETROPLATFORMIPC_H__
diff --git a/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt b/od-win32/cloanto/RetroPlatformIPC_doc_draft.txt
new file mode 100755 (executable)
index 0000000..a867aea
--- /dev/null
@@ -0,0 +1,532 @@
+Reference for RetroPlatformIPC.h (RP Player interprocess communication include file)
+
+
+****************************************************************************
+ Guest-to-Host Messages
+****************************************************************************
+
+Message:
+   RPIPCGM_REGISTER
+Description:
+   this is a private message and is automatically sent
+   by the RPInitializeGuest() function
+   to register the caller as a RetroPlatform guest
+
+
+Message:
+   RPIPCGM_FEATURES
+Description:
+   the guest uses this message to tell the host
+   about the features it supports;
+   at startup time, the guest sends initialization messages
+   so that the host can adapt the GUI based on the reported features;
+   these messages include:
+      RPIPCGM_FEATURES (describes guest features),
+      RPIPCGM_POWERLED (turns on the power LED in the GUI),
+      RPIPCGM_DEVICES (one for each device category: tells the number of emulated devices),
+      RPIPCGM_DEVICECONTENT (one for each device with an image file or peripheral attached),
+      RPIPCGM_TURBO (tells if some of the turbo modes are activated from the start),
+      RPIPCGM_VOLUME (reports about starting volume level),
+      RPIPCGM_SCREENMODE (communicates the screen mode and the guest window handle);
+   note that at startup time the guest should create a borderless and hidden window
+   and send its handle using a RPIPCGM_SCREENMODE message, which must be the last
+   of the initialization messages, since it displays the guest window
+   and the host "frame window" (the part of the player user interface
+   with command and status icons which can be used to drag the guest window, etc.)
+Data sent:
+   WPARAM = RP_FEATURE_* flags
+Response:
+   none
+
+
+Message:
+   RPIPCGM_CLOSED
+Description:
+   this message is sent to the host when the guest is terminating
+Data sent:
+   none
+Response:
+   none
+
+
+Message:
+   RPIPCGM_ACTIVATED
+Description:
+   the guest sends this message to the host
+   when its window is being activated
+Data sent:
+   LPARAM = identifier of the thread that owns the window being deactivated
+Response:
+   none
+
+
+Message:
+   RPIPCGM_DEACTIVATED
+Description:
+   the guest sends this message to the host
+   when its window is being deactivated
+Data sent:
+   LPARAM = identifier of the thread that owns the window being activated
+Response:
+   none
+
+
+Message:
+   RPIPCGM_SCREENMODE
+Description:
+   the guest sends a RPIPCGM_SCREENMODE message to notify the host
+   about a change in its "screen mode" (1x/2x/4x/full screen, etc.);
+   screen mode changes requested by the host
+   (see the RPIPCHM_SCREENMODE message) must not be notified,
+   unless this is an asynchronous screen mode change
+   (i.e. the guest returned the INVALID_HANDLE_VALUE
+   response to a RPIPCHM_SCREENMODE host request);
+   this message can also be sent when the guest has to close
+   and reopen its window for other reasons;
+   at startup-time, the guest must create
+   a borderless and hidden window and send its handle
+   using this message; the host will then take care
+   of preparing, positioning and showing the guest window
+Data sent:
+   WPARAM = new screen mode (RP_SCREENMODE_* value)
+   LPARAM = handle of the (new) guest window
+Response:
+   none
+
+
+Message:
+   RPIPCGM_POWERLED
+Description:
+   sent to the host to change the power LED state
+Data sent:
+   WPARAM = power LED intensity (min/off 0, max 100)
+Response:
+   none
+
+
+Message:
+   RPIPCGM_DEVICES
+Description:
+   this message is used to notify the host about a change
+   in the number of emulated devices (floppy drives, hard disks, etc.)
+Data sent:
+   WPARAM = device category (RP_DEVICE_* value)
+   LPARAM = 32-bit bitfield representing the devices
+            emulated in the specified category
+            (every bit set to 1 corresponds to a mounted drive
+             e.g. 0x00000005 = drive 0 and drive 2 are emulated)
+Response:
+   none
+
+
+Message:
+   RPIPCGM_DEVICEACTIVITY
+Description:
+   this message can be used to turn on or off the activity indicator
+   of a specified device (like a LED on the original hardware);
+   the indicator can also be "blinked", i.e. the host will turn the
+   LED on and then off again after the specified amount of time
+Data sent:
+   WPARAM = device category (RP_DEVICE_* value) and device number
+            combined with the MAKEWORD macro;
+            e.g. MAKEWORD(RP_DEVICE_FLOPPY, 0);
+            the RP_ALL_DEVICES define may be used as device number
+            to turn on or off all the activity leds for a device category
+   LPARAM = 0 turns off the activity LED,
+            (LPARAM)-1 turns on the activity LED,
+            <millisecond delay> turns on the activity LED
+            for the specified amount of time (blink)
+Response:
+   none
+
+
+Message:
+   RPIPCGM_MOUSECAPTURE
+Description:
+   the guest sends this message when the mouse is captured/released
+   (the mouse is "captured" when its movements are restricted to the guest window area
+   and the system cursor is not visible);
+   mouse capture changes requested by the host
+   (see the RPIPCHM_MOUSECAPTURE message) must not be notified;
+   for consistency across different guests, a guest which sends RPIPCGM_MOUSECAPTURE
+   messages should also implement a keyboard-actuated escape functionality
+   (the preferred key for this purpose is included in the parameters sent from the
+   host at startup time - see RPLaunchGuest() in RetroPlatformPlugin.h);
+   note that in order not to interfere with the window dragging functionality,
+   the mouse should not be captured when the guest window gets the focus,
+   but when a mouse button event is received
+Data sent:
+   WPARAM = mouse capture state (RP_MOUSECAPTURE_* value)
+Response:
+   none
+
+
+Message:
+   RPIPCGM_HOSTAPIVERSION
+Description:
+    the guest can send a RPIPCGM_HOSTAPIVERSION to query the host
+    about the RetroPlatform API version it implements;
+    since the guest plugin already asks for a minimim version of the API
+    on the host side, this message can be used to check the host API version
+    and enable optional functionality
+Data sent:
+   none
+Response:
+   LRESULT = major and minor version combined with the MAKELONG macro
+             (e.g. LOWORD(lr) = major version; HIWORD(lr) = minor version)
+
+
+Message:
+   RPIPCGM_PAUSE
+Description:
+   the guest sends this message to the host
+   when it enters or exits pause mode;
+   pause mode changes requested by the host
+   (see the RPIPCHM_PAUSE message) must not be notified;
+   note: when paused, the guest should release the mouse (if captured)
+Data sent:
+   WPARAM = non-zero when the guest enters pause mode
+            or zero when the guest exits from pause mode
+Response:
+   none
+
+
+Message:
+   RPIPCGM_DEVICECONTENT
+Description:
+   the guest sends a RPIPCGM_DEVICECONTENT message
+   to notify the host that an image file (e.g. a floppy disk image)
+   or a peripheral (e.g. a joystick)
+   has been loaded into (or ejected from) an emulated device;
+   this notification must not be sent when the event
+   has been requested by the host (see the RPIPCHM_DEVICECONTENT message)
+Data sent:
+   pData = a RPDEVICECONTENT structure (see below);
+           the szImageFile field of the structure
+           contains an empty string when the guest
+           is ejecting something from the device
+Response:
+   none
+
+
+Message:
+   RPIPCGM_TURBO
+Description:
+   the guest sends a RPIPCGM_TURBO message
+   to notify the host about activation of "turbo" (maximum speed) mode
+   of some of its functionalities (e.g. floppy, CPU);
+   turbo mode activations/deactivations requested by the host
+   (see the RPIPCHM_TURBO message) must not be notified;
+Data sent:
+   WPARAM = mask of functionalities affected (RP_TURBO_* flags)
+   LPARAM = bits corresponding to those set in WPARAM
+            (1 = turbo mode activated for the guest functionality
+             0 = guest functionality reverted to normal speed)
+Response:
+   none
+
+
+Message:
+   RPIPCGM_PING
+Description:
+   this is a no-operation message and can be sent
+   to check if the host is responsive and functional
+Data sent:
+   none
+Response:
+   LRESULT = non-zero value is returned
+
+
+Message:
+   RPIPCGM_VOLUME
+Description:
+   the guest uses the RPIPCGM_VOLUME message
+   to notify the host about a change of its audio level;
+   audio level changes requested by the host
+   (see the RPIPCHM_VOLUME message) must not be notified
+Data sent:
+   WPARAM = volume level (min/off 0, max 100)
+Response:
+   none
+
+
+Message:
+   RPIPCGM_ESCAPED
+Description:
+   this message is sent to notify the host
+   that the escape key has been held down
+Data sent:
+   none
+Response:
+   none
+
+
+Message:
+   RPIPCGM_PARENT
+Description:
+   the guest sends this message to the host to get the handle
+   of the parent for its window; the guest window must be created
+   as a borderless (WS_POPUP style), hidden window,
+   using the handle returned by this message as the parent window parameter
+Data sent:
+   none
+Response:
+   LRESULT = window handle (HWND) to use in a CreateWindow call
+
+
+Message:
+   RPIPCGM_DEVICESEEK
+Description:
+   this message can be used to notify the host about a seek operation
+   of a specified device (e.g. the head of a disk drive changes position);
+Data sent:
+   WPARAM = device category (RP_DEVICE_* value) and device number
+            combined with the MAKEWORD macro;
+            e.g. MAKEWORD(RP_DEVICE_FLOPPY, 0)
+   LPARAM = device-dependant seek position (e.g. drive track position)
+Response:
+   none
+
+
+
+
+
+****************************************************************************
+ Host-to-Guest Messages
+****************************************************************************
+
+Message:
+   RPIPCHM_CLOSE
+Description:
+   sent from the host when the emulation must be terminated
+   (e.g. the user has hit the close button in the host window);
+   the guest should destroy its window and terminate (see Response below)
+Data sent:
+   none
+Response:
+   LRESULT = non-zero if the guest can safely terminate or 0 otherwise
+
+
+Message:
+   RPIPCHM_SCREENMODE
+Description:
+   this message is sent to ask the guest to activate a specified screen mode;
+   when switching to the new screen mode, the guest can resize (reuse) its window
+   or close its window and open a new one
+Data sent:
+   WPARAM = RP_SCREENMODE_* value
+Response:
+   LRESULT = handle of the (new) guest window
+             or NULL (the screen mode couldn't be changed)
+             or INVALID_HANDLE_VALUE (the screen mode will be changed asynchronously
+             and the host will soon get a RPIPCGM_SCREENMODE notification)
+
+
+Message:
+   RPIPCHM_SCREENCAPTURE
+Description:
+   with this message the host asks the guest to save its screen
+   to the the specified file in BMP format
+Data sent:
+   pData = (Unicode) full path and name of the file to save
+           (note: the file may exist and can be overwritten)
+Response:
+   LRESULT = non-zero if the guest saved its screen to the file
+
+
+Message:
+   RPIPCHM_PAUSE
+Description:
+   the RPIPCHM_PAUSE message sets the guest into pause mode
+   or resumes the guest from pause mode;
+   note: when paused, the guest should release the mouse (if captured)
+Data sent:
+   WPARAM = non-zero to set the guest into pause mode
+            or zero to resume the guest from pause mode
+Response:
+   LRESULT = non-zero if the guest executed the command
+
+
+Message:
+   RPIPCHM_DEVICECONTENT
+Description:
+   the host sends a RPIPCHM_DEVICECONTENT message
+   to load an image file or a peripheral into an emulated device
+   (e.g. an ADF floppy file into a floppy drive,
+   or a physical or keyboard-emulated joystick into an input port)
+   or to unload the currently loaded content from the device
+Data sent:
+   pData = a RPDEVICECONTENT structure (see below);
+           if the szImageFile field of the structure
+           contains an empty string, the guest should
+           unload the current content from the device
+Response:
+   LRESULT = non-zero if the guest executed the command
+
+
+Message:
+   RPIPCHM_RESET
+Description:
+   the host sends this message to reset the guest
+Data sent:
+   WPARAM = a RP_RESET_* value
+Response:
+   LRESULT = non-zero if the guest executed the command
+
+
+Message:
+   RPIPCHM_TURBO
+Description:
+   the host sends this message to activate or deactivate
+   the turbo mode of selected guest functionalities
+Data sent:
+   WPARAM = mask of functionalities to change (RP_TURBO_* flags)
+   LPARAM = bits corresponding to those set in WPARAM
+            (1 = speedup the guest functionality
+             0 = revert to normal speed emulation)
+Response:
+   LRESULT = non-zero if the guest executed the command
+
+
+Message:
+   RPIPCHM_PING
+Description:
+   this is a no-operation message and can be sent
+   to check if the guest is responsive and functional
+Data sent:
+   none
+Response:
+   LRESULT = non-zero value is returned
+
+
+Message:
+   RPIPCHM_VOLUME
+Description:
+   the host uses the RPIPCHM_VOLUME message to set
+   the audio level of the guest
+Data sent:
+   WPARAM = volume level (min 0, max 100)
+Response:
+   LRESULT = non-zero if the guest set the volume as requested
+
+
+Message:
+   RPIPCHM_ESCAPEKEY
+Description:
+   the host uses the RPIPCHM_ESCAPEKEY message
+   to change the escape key information
+Data sent:
+   WPARAM = DirectInput DIK_* identifier of the escape key
+            (e.g. 1 for the Esc key - see DIK_* constants in dinput.h)
+   LPARAM = milliseconds value
+            (amount of time the user has to hold the above key to trigger the escape functionality)
+Response:
+   LRESULT = non-zero if the guest accepted the new settings
+
+
+Message:
+   RPIPCHM_EVENT
+Description:
+   the host uses the RPIPCHM_EVENT message
+   to simulate keyboard, mouse, joystick (press/release)
+   and other guest-specific events
+Data sent:
+   pData = (Unicode) event string (guest-specific)
+Response:
+   LRESULT = non-zero if the guest simulated the specified event
+
+
+Message:
+   RPIPCHM_MOUSECAPTURE
+Description:
+   the host uses this message to ask the guest
+   to capture or release the mouse
+Data sent:
+   WPARAM = mouse capture state being requested (RP_MOUSECAPTURE_* value)
+Response:
+   LRESULT = non-zero if the guest executed the command
+
+
+Message:
+   RPIPCHM_SCREENCLIP
+Description:
+   this command is used to set the clipping coordinates of the screen
+Data sent:
+   pData = a RPSCREENCLIP structure
+Response:
+   LRESULT = non-zero if the guest executed the command
+
+
+
+// ****************************************************************************
+//  Message Data Structures and Defines
+// ****************************************************************************
+
+// Guest Features
+#define RP_FEATURE_POWERLED      0x00000001 // a power LED is emulated
+#define RP_FEATURE_SCREEN1X      0x00000002 // 1x windowed mode is available
+#define RP_FEATURE_SCREEN2X      0x00000004 // 2x windowed mode is available
+#define RP_FEATURE_SCREEN4X      0x00000008 // 4x windowed mode is available
+#define RP_FEATURE_FULLSCREEN    0x00000010 // full screen display is available
+#define RP_FEATURE_SCREENCAPTURE 0x00000020 // screen capture functionality is available (see RPIPCHM_SCREENCAPTURE message)
+#define RP_FEATURE_PAUSE         0x00000040 // pause functionality is available (see RPIPCHM_PAUSE message)
+#define RP_FEATURE_TURBO         0x00000080 // turbo mode functionality is available (see RPIPCHM_TURBO message)
+#define RP_FEATURE_VOLUME        0x00000100 // volume adjustment is possible (see RPIPCHM_VOLUME message)
+
+// Screen Modes
+#define RP_SCREENMODE_1X          0 // 1x windowed mode
+#define RP_SCREENMODE_2X          1 // 2x windowed mode
+#define RP_SCREENMODE_4X          2 // 4x windowed mode
+#define RP_SCREENMODE_FULLSCREEN  3 // full screen
+
+// Device Categories
+#define RP_DEVICE_FLOPPY    0 // floppy disk drive
+#define RP_DEVICE_HD        1 // hard disk drive
+#define RP_DEVICE_CD        2 // CD/DVD drive
+#define RP_DEVICE_NET       3 // network card
+#define RP_DEVICE_TAPE      4 // cassette tape drive
+#define RP_DEVICE_CARTRIDGE 5 // expansion cartridge
+#define RP_DEVICE_INPUTPORT 6 // input port
+
+typedef struct RPDeviceContent
+{
+       BYTE  btDeviceCategory; // RP_DEVICE_* value
+       BYTE  btDeviceNumber;   // device number (range 0..31)
+       WCHAR szContent[1];     // full path and name of the image file to load, or input port device (Unicode, variable-sized field)
+} RPDEVICECONTENT;
+
+// Input Port Devices
+#define RP_IPD_MOUSE1    L"Mouse1" // first mouse type (e.g. Windows Mouse for WinUAE)
+#define RP_IPD_MOUSE2    L"Mouse2" // second mouse type (e.g. Mouse for WinUAE)
+#define RP_IPD_MOUSE3    L"Mouse3" // third mouse type (e.g. Mousehack Mouse for WinUAE)
+#define RP_IPD_MOUSE4    L"Mouse4" // fourth mouse type (e.g. RAW Mouse for WinUAE)
+#define RP_IPD_JOYSTICK1 L"Joystick1" // first joystick type (e.g. standard joystick for WinUAE, described as "Joystick1\ProductGUID\ProductName")
+#define RP_IPD_JOYSTICK2 L"Joystick2" // second joystick type (e.g. X-Arcade (Left) joystick for WinUAE, described as "Joystick2\ProductGUID\ProductName")
+#define RP_IPD_JOYSTICK3 L"Joystick3" // third joystick type (e.g. X-Arcade (Right) joystick for WinUAE, described as "Joystick3\ProductGUID\ProductName")
+#define RP_IPD_KEYBDL1   L"KeyboardLayout1" // first joystick emulation keyboard layout (e.g. Keyboard Layout A for WinUAE)
+#define RP_IPD_KEYBDL2   L"KeyboardLayout2" // second joystick emulation keyboard layout (e.g. Keyboard Layout B for WinUAE)
+#define RP_IPD_KEYBDL3   L"KeyboardLayout3" // third joystick emulation keyboard layout (e.g. Keyboard Layout C for WinUAE)
+
+// Turbo Mode Functionalities
+#define RP_TURBO_CPU     0x00000001 // CPU
+#define RP_TURBO_FLOPPY  0x00000002 // floppy disk drive
+#define RP_TURBO_TAPE    0x00000004 // cassette tape drive
+
+// Reset Type
+#define RP_RESET_SOFT  0 // soft reset
+#define RP_RESET_HARD  1 // hard reset
+
+// RPIPCGM_MOUSECAPTURE/RPIPCHM_MOUSECAPTURE
+#define RP_MOUSECAPTURE_UNCAPTURED   0
+#define RP_MOUSECAPTURE_CAPTURED     1
+#define RP_MOUSECAPTURE_MAGICMOUSE   2
+
+typedef struct RPScreenClip
+{
+       LONG lLeft;
+       LONG lTop;
+       LONG lWidth;
+       LONG lHeight;
+} RPSCREENCLIP;
+
+#endif // __CLOANTO_RETROPLATFORMIPC_H__
index 298f7c3274a5b8cb5b8303ea752bdf8c724a399f..7387f7bddbe52246526c28cd967956721f9d855f 100755 (executable)
@@ -118,7 +118,7 @@ void unlocksurface (LPDIRECTDRAWSURFACE7 surf)
 }
 
 static char *alloctexts[] = { "NonLocalVRAM", "DefaultRAM", "VRAM", "RAM" };
-LPDIRECTDRAWSURFACE7 allocsurface_2 (int width, int height, int forcemode)
+LPDIRECTDRAWSURFACE7 allocsurface_2 (int width, int height, uae_u8 *ptr, int pitch, int forcemode)
 {
     HRESULT ddrval;
     DDSURFACEDESC2 desc;
@@ -136,13 +136,17 @@ LPDIRECTDRAWSURFACE7 allocsurface_2 (int width, int height, int forcemode)
         desc.ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
     desc.dwWidth = width;
     desc.dwHeight = height;
+    if (ptr) {
+       desc.dwFlags |= DDSD_LPSURFACE | DDSD_PITCH;
+       desc.lPitch = pitch;
+       desc.lpSurface = ptr;
+    }
     memcpy (&desc.ddpfPixelFormat, &dxdata.native.ddpfPixelFormat, sizeof (DDPIXELFORMAT));
     ddrval = IDirectDraw7_CreateSurface (dxdata.maindd, &desc, &surf, NULL);
     if (FAILED (ddrval)) {
        write_log ("IDirectDraw7_CreateSurface (%dx%d,%s): %s\n", width, height, alloctexts[forcemode], DXError (ddrval));
     } else {
-        clearsurf (surf);
-        write_log ("Created %dx%d surface in %s (%d)\n", width, height, alloctexts[forcemode]);
+        write_log ("Created %dx%d surface in %s (%d)\n", width, height, alloctexts[forcemode], forcemode);
     }
     return surf;
 }
@@ -153,9 +157,11 @@ LPDIRECTDRAWSURFACE7 allocsurface (int width, int height)
     int mode = ddforceram;
 
     for (;;) {
-       s = allocsurface_2 (width, height, mode);
-       if (s)
+       s = allocsurface_2 (width, height, NULL, 0, mode);
+       if (s) {
+           clearsurf (s);
            return s;
+       }
        mode++;
        if (mode >= 4)
            mode = 0;
@@ -163,6 +169,10 @@ LPDIRECTDRAWSURFACE7 allocsurface (int width, int height)
            return NULL;
     }
 }
+LPDIRECTDRAWSURFACE7 createsurface (uae_u8 *ptr, int pitch, int width, int height)
+{
+    return allocsurface_2 (width, height, ptr, pitch, DDFORCED_SYSMEM);
+}
 
 void freesurface (LPDIRECTDRAWSURFACE7 surf)
 {
@@ -321,13 +331,15 @@ const char *DXError (HRESULT ddrval)
     return dderr;
 }
 
-RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface)
+RGBFTYPE DirectDraw_GetSurfacePixelFormat (LPDDSURFACEDESC2 surface)
 {
     int surface_is = 0;
     DDPIXELFORMAT *pfp = NULL;
     DWORD r, g, b;
     DWORD surf_flags;
 
+    if (surface == NULL)
+       surface = &dxdata.native;
     surf_flags = surface->dwFlags;
     pfp = &surface->ddpfPixelFormat;
 
@@ -340,7 +352,8 @@ RGBFTYPE DirectDraw_GetSurfacePixelFormat(LPDDSURFACEDESC2 surface)
     r = pfp->dwRBitMask;
     g = pfp->dwGBitMask;
     b = pfp->dwBBitMask;
-    switch (pfp->dwRGBBitCount) {
+    switch (pfp->dwRGBBitCount)
+    {
      case 8:
        if ((pfp->dwFlags & DDPF_PALETTEINDEXED8) != 0)
            return RGBFB_CHUNKY;
index a307f07e65191c8ff056b86b09c27383bb1f0536..950d012d82e3a0af6763ede6a42213dcb9fe60b0 100755 (executable)
@@ -1,8 +1,11 @@
 #ifndef __DXWRAP_H__
 #define __DXWRAP_H__
 
+#include "rtgmodes.h"
 #include "ddraw.h"
 
+extern int ddforceram;
+
 struct ddstuff
 {
     int ddinit;
@@ -51,77 +54,12 @@ struct MultiDisplay {
     int primary, disabled, gdi;
     GUID guid;
     char *name;
+    char *name2;
     struct PicassoResolution *DisplayModes;
     RECT rect;
 };
 extern struct MultiDisplay Displays[MAX_DISPLAYS];
 
-/* Types for RGBFormat used */
-typedef enum {
-    RGBFB_NONE,                /* no valid RGB format (should not happen) */
-    RGBFB_CLUT,                /* palette mode, set colors when opening screen using
-                          tags or use SetRGB32/LoadRGB32(...) */
-    RGBFB_R8G8B8,      /* TrueColor RGB (8 bit each) */
-    RGBFB_B8G8R8,      /* TrueColor BGR (8 bit each) */
-    RGBFB_R5G6B5PC,    /* HiColor16 (5 bit R, 6 bit G, 5 bit B),
-                          format: gggbbbbbrrrrrggg */
-    RGBFB_R5G5B5PC,    /* HiColor15 (5 bit each), format: gggbbbbb0rrrrrgg */
-    RGBFB_A8R8G8B8,    /* 4 Byte TrueColor ARGB (A unused alpha channel) */
-    RGBFB_A8B8G8R8,    /* 4 Byte TrueColor ABGR (A unused alpha channel) */
-    RGBFB_R8G8B8A8,    /* 4 Byte TrueColor RGBA (A unused alpha channel) */
-    RGBFB_B8G8R8A8,    /* 4 Byte TrueColor BGRA (A unused alpha channel) */
-    RGBFB_R5G6B5,      /* HiColor16 (5 bit R, 6 bit G, 5 bit B),
-                          format: rrrrrggggggbbbbb */
-    RGBFB_R5G5B5,      /* HiColor15 (5 bit each), format: 0rrrrrgggggbbbbb */
-    RGBFB_B5G6R5PC,    /* HiColor16 (5 bit R, 6 bit G, 5 bit B),
-                          format: gggrrrrrbbbbbggg */
-    RGBFB_B5G5R5PC,    /* HiColor15 (5 bit each), format: gggrrrrr0bbbbbbgg */
-
-    /* By now, the following formats are for use with a hardware window only
-       (bitmap operations may be implemented incompletely) */
-
-    RGBFB_Y4U2V2,      /* 2 Byte TrueColor YUV (CCIR recommendation CCIR601).
-                          Each two-pixel unit is stored as one longword
-                          containing luminance (Y) for each of the two pixels,
-                          and chrominance (U,V) for alternate pixels.
-                          The missing chrominance values are generated by
-                          interpolation. (Y1-U0-Y0-V0) */
-    RGBFB_Y4U1V1,      /* 1 Byte TrueColor ACCUPAK. Four adjacent pixels form
-                          a packet of 5 bits Y (luminance) each pixel and 6 bits
-                          U and V (chrominance) shared by the four pixels */
-
-    RGBFB_MaxFormats
-} RGBFTYPE;
-
-#define RGBFF_NONE     (1<<RGBFB_NONE)
-#define RGBFF_CLUT     (1<<RGBFB_CLUT)
-#define RGBFF_R8G8B8   (1<<RGBFB_R8G8B8)
-#define RGBFF_B8G8R8   (1<<RGBFB_B8G8R8)
-#define RGBFF_R5G6B5PC (1<<RGBFB_R5G6B5PC)
-#define RGBFF_R5G5B5PC (1<<RGBFB_R5G5B5PC)
-#define RGBFF_A8R8G8B8 (1<<RGBFB_A8R8G8B8)
-#define RGBFF_A8B8G8R8 (1<<RGBFB_A8B8G8R8)
-#define RGBFF_R8G8B8A8 (1<<RGBFB_R8G8B8A8)
-#define RGBFF_B8G8R8A8 (1<<RGBFB_B8G8R8A8)
-#define RGBFF_R5G6B5   (1<<RGBFB_R5G6B5)
-#define RGBFF_R5G5B5   (1<<RGBFB_R5G5B5)
-#define RGBFF_B5G6R5PC (1<<RGBFB_B5G6R5PC)
-#define RGBFF_B5G5R5PC (1<<RGBFB_B5G5R5PC)
-#define RGBFF_Y4U2V2   (1<<RGBFB_Y4U2V2)
-#define RGBFF_Y4U1V1   (1<<RGBFB_Y4U1V1)
-
-#define RGBMASK_8BIT RGBFF_CLUT
-#define RGBMASK_16BIT (RGBFF_R5G6B5PC | RGBFF_B5G6R5PC | RGBFF_R5G6B5)
-#define RGBMASK_15BIT (RGBFF_R5G5B5PC | RGBFF_B5G5R5PC | RGBFF_R5G5B5)
-#define RGBMASK_24BIT (RGBFF_R8G8B8 | RGBFF_B8G8R8)
-#define RGBMASK_32BIT (RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8)
-
-#define        RGBFF_PLANAR    RGBFF_NONE
-#define        RGBFF_CHUNKY    RGBFF_CLUT
-
-#define        RGBFB_PLANAR    RGBFB_NONE
-#define        RGBFB_CHUNKY    RGBFB_CLUT
-
 typedef enum
 {
     red_mask,
@@ -139,6 +77,7 @@ void clearsurface(LPDIRECTDRAWSURFACE7 surf);
 int locksurface (LPDIRECTDRAWSURFACE7 surf, LPDDSURFACEDESC2 desc);
 void unlocksurface (LPDIRECTDRAWSURFACE7 surf);
 LPDIRECTDRAWSURFACE7 allocsurface (int width, int height);
+LPDIRECTDRAWSURFACE7 createsurface (uae_u8 *ptr, int pitch, int width, int height);
 void freesurface (LPDIRECTDRAWSURFACE7 surf);
 void DirectDraw_FreeMainSurface (void);
 HRESULT DirectDraw_CreateMainSurface (int width, int height);
index 85a4648ccd6512765e9a1c04d2a397ca883427bc..27e471436026c202d607486d9f79a585c4197117 100755 (executable)
@@ -132,16 +132,17 @@ static uae_u8 *memwatchtable;
 
 int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddresses, PULONG_PTR lpdwCount, PULONG lpdwGranularity)
 {
-    int i, j;
+    int i, j, off;
 
     if (memwatchok)
        return GetWriteWatch (0, lpBaseAddress, dwRegionSize, lpAddresses, lpdwCount, lpdwGranularity);
     j = 0;
-    for (i = 0; i < p96mem_size / si.dwPageSize; i++) {
+    off = ((uae_u8*)lpBaseAddress - (natmem_offset + p96ram_start)) / si.dwPageSize;
+    for (i = 0; i < dwRegionSize / si.dwPageSize; i++) {
        if (j >= *lpdwCount)
            break;
-       if (memwatchtable[i])
-           lpAddresses[j++] = p96mem_offset + i * si.dwPageSize;
+       if (memwatchtable[off + i])
+           lpAddresses[j++] = (uae_u8*)lpBaseAddress + i * si.dwPageSize;
     }
     *lpdwCount = j;
     *lpdwGranularity = si.dwPageSize;
@@ -183,6 +184,7 @@ typedef BOOL (CALLBACK* GLOBALMEMORYSTATUSEX)(LPMEMORYSTATUSEX);
 
 void preinit_shm (void)
 {
+    int i;
     uae_u64 total64;
     uae_u64 totalphys64;
     MEMORYSTATUS memstats;
@@ -223,14 +225,47 @@ void preinit_shm (void)
     if (max_z3fastmem < 512 * 1024 * 1024)
        max_z3fastmem = 512 * 1024 * 1024;
 
+    shm_start = 0;
+    for (i = 0; i < MAX_SHMID; i++) {
+        shmids[i].attached = 0;
+        shmids[i].key = -1;
+        shmids[i].size = 0;
+        shmids[i].addr = NULL;
+        shmids[i].name[0] = 0;
+    }
+
     write_log ("Max Z3FastRAM %dM. Total physical RAM %uM\n", max_z3fastmem >> 20, totalphys64 >> 20);
     testwritewatch ();
     canbang = 1;
 }
 
-int init_shm (void)
+static void resetmem (void)
 {
     int i;
+
+    if (!shm_start)
+       return;
+    for (i = 0; i < MAX_SHMID; i++) {
+       struct shmid_ds *s = &shmids[i];
+       int size = s->size;
+       uae_u8 *shmaddr;
+       uae_u8 *result;
+
+       if (!s->attached)
+           continue;
+       if (!s->natmembase)
+           continue;
+       shmaddr = natmem_offset + ((uae_u8*)s->attached - (uae_u8*)s->natmembase);
+       result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, s->mode);
+       if (result != shmaddr)
+           write_log ("NATMEM: realloc(%p,%d,%d) failed, err=%x\n", shmaddr, size, s->mode, GetLastError ());
+       else
+           write_log ("NATMEM: rellocated(%p,%d,%s)\n", shmaddr, size, s->name);
+    }
+}
+
+int init_shm (void)
+{
     uae_u32 size, totalsize, z3size, natmemsize, rtgbarrier, rtgextra;
     int rounds = 0;
 
@@ -272,14 +307,6 @@ restart:
        }
        natmemsize = size + z3size;
 
-       shm_start = 0;
-       for (i = 0; i < MAX_SHMID; i++) {
-           shmids[i].attached = 0;
-           shmids[i].key = -1;
-           shmids[i].size = 0;
-           shmids[i].addr = NULL;
-           shmids[i].name[0] = 0;
-       }
        xfree (memwatchtable);
        memwatchtable = 0;
        if (currprefs.gfxmem_size) {
@@ -338,11 +365,13 @@ restart:
        natmem_offset_end = p96mem_offset + currprefs.gfxmem_size;
     }
 
+    resetmem ();
+
     return canbang;
 }
 
 
-void mapped_free(uae_u8 *mem)
+void mapped_free (uae_u8 *mem)
 {
     shmpiece *x = shm_start;
 
@@ -354,6 +383,8 @@ void mapped_free(uae_u8 *mem)
                shmids[shmid].name[0] = '\0';
                shmids[shmid].size = 0;
                shmids[shmid].attached = 0;
+               shmids[shmid].mode = 0;
+               shmids[shmid].natmembase = 0;
            }
            x = x->next;
        }
@@ -362,21 +393,21 @@ void mapped_free(uae_u8 *mem)
 
     while(x) {
        if(mem == x->native_address)
-           shmdt(x->native_address);
+           shmdt (x->native_address);
        x = x->next;
     }
     x = shm_start;
     while(x) {
        struct shmid_ds blah;
        if (mem == x->native_address) {
-           if (shmctl(x->id, IPC_STAT, &blah) == 0)
-               shmctl(x->id, IPC_RMID, &blah);
+           if (shmctl (x->id, IPC_STAT, &blah) == 0)
+               shmctl (x->id, IPC_RMID, &blah);
        }
        x = x->next;
     }
 }
 
-static key_t get_next_shmkey(void)
+static key_t get_next_shmkey (void)
 {
     key_t result = -1;
     int i;
@@ -390,7 +421,7 @@ static key_t get_next_shmkey(void)
     return result;
 }
 
-STATIC_INLINE key_t find_shmkey(key_t key)
+STATIC_INLINE key_t find_shmkey (key_t key)
 {
     int result = -1;
     if(shmids[key].key == key) {
@@ -399,13 +430,13 @@ STATIC_INLINE key_t find_shmkey(key_t key)
     return result;
 }
 
-int mprotect(void *addr, size_t len, int prot)
+int mprotect (void *addr, size_t len, int prot)
 {
     int result = 0;
     return result;
 }
 
-void *shmat(int shmid, void *shmaddr, int shmflg)
+void *shmat (int shmid, void *shmaddr, int shmflg)
 {
     void *result = (void *)-1;
     BOOL got = FALSE;
@@ -413,10 +444,12 @@ void *shmat(int shmid, void *shmaddr, int shmflg)
     DWORD protect = PAGE_READWRITE;
 
 #ifdef NATMEM_OFFSET
-    unsigned int size=shmids[shmid].size;
-    if(shmids[shmid].attached)
+    unsigned int size = shmids[shmid].size;
+
+    if (shmids[shmid].attached)
        return shmids[shmid].attached;
-    if ((uae_u8*)shmaddr<natmem_offset) {
+
+    if ((uae_u8*)shmaddr < natmem_offset) {
        if(!strcmp(shmids[shmid].name,"chip")) {
            shmaddr=natmem_offset;
            got = TRUE;
@@ -479,7 +512,7 @@ void *shmat(int shmid, void *shmaddr, int shmflg)
        }
        if(!strcmp(shmids[shmid].name,"filesys")) {
            result = xcalloc (size, 1);
-           shmids[shmid].attached=result;
+           shmids[shmid].attached = result;
            return result;
        }
        if(!strcmp(shmids[shmid].name,"hrtmon")) {
@@ -513,37 +546,33 @@ void *shmat(int shmid, void *shmaddr, int shmflg)
 }
 #endif
 
-    if ((shmids[shmid].key == shmid) && shmids[shmid].size) {
-       got = FALSE;
-       if (got == FALSE) {
-           if (shmaddr)
-               virtualfreewithlock (shmaddr, size, MEM_DECOMMIT);
-           result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, protect);
-           if (result == NULL) {
-               result = (void*)-1;
-               write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) failed %d\n",
-                   (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
-                   size, size >> 10, GetLastError());
-           } else {
-               shmids[shmid].attached = result;
-               write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) ok%s\n",
-                   (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
-                   size, size >> 10, p96special ? " P96" : "");
-           }
-       } else {
-           shmids[shmid].attached = shmaddr;
-           result = shmaddr;
+    if (shmids[shmid].key == shmid && shmids[shmid].size) {
+       shmids[shmid].mode = protect;
+       shmids[shmid].natmembase = natmem_offset;
+        if (shmaddr)
+           virtualfreewithlock (shmaddr, size, MEM_DECOMMIT);
+       result = virtualallocwithlock (shmaddr, size, MEM_COMMIT, protect);
+       if (result == NULL) {
+           result = (void*)-1;
+           write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) failed %d\n",
+               (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
+               size, size >> 10, GetLastError());
+        } else {
+           shmids[shmid].attached = result;
+           write_log ("VirtualAlloc %08.8X - %08.8X %x (%dk) ok%s\n",
+               (uae_u8*)shmaddr - natmem_offset, (uae_u8*)shmaddr - natmem_offset + size,
+               size, size >> 10, p96special ? " P96" : "");
        }
     }
     return result;
 }
 
-int shmdt(const void *shmaddr)
+int shmdt (const void *shmaddr)
 {
     return 0;
 }
 
-int shmget(key_t key, size_t size, int shmflg, char *name)
+int shmget (key_t key, size_t size, int shmflg, char *name)
 {
     int result = -1;
 
@@ -559,11 +588,11 @@ int shmget(key_t key, size_t size, int shmflg, char *name)
     return result;
 }
 
-int shmctl(int shmid, int cmd, struct shmid_ds *buf)
+int shmctl (int shmid, int cmd, struct shmid_ds *buf)
 {
     int result = -1;
 
-    if ((find_shmkey(shmid) != -1) && buf) {
+    if ((find_shmkey (shmid) != -1) && buf) {
        switch(cmd)
        {
            case IPC_STAT:
@@ -571,11 +600,12 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
                result = 0;
            break;
            case IPC_RMID:
-               VirtualFree(shmids[shmid].attached, shmids[shmid].size, MEM_DECOMMIT);
+               VirtualFree (shmids[shmid].attached, shmids[shmid].size, MEM_DECOMMIT);
                shmids[shmid].key = -1;
                shmids[shmid].name[0] = '\0';
                shmids[shmid].size = 0;
                shmids[shmid].attached = 0;
+               shmids[shmid].mode = 0;
                result = 0;
            break;
        }
@@ -585,9 +615,9 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
 
 #endif
 
-int isinf(double x)
+int isinf (double x)
 {
-    const int nClass = _fpclass(x);
+    const int nClass = _fpclass (x);
     int result;
     if (nClass == _FPCLASS_NINF || nClass == _FPCLASS_PINF)
        result = 1;
index 0861c9963da7e21b6c2e76751ad051922cde2b6d..16b8578865c173be4d3bd6e5be0117a40b6a358d 100755 (executable)
@@ -53,7 +53,6 @@ static char prtbuf[PRTBUFSIZE];
 static int prtbufbytes,wantwrite;
 static HANDLE hPrt = INVALID_HANDLE_VALUE;
 static DWORD  dwJob;
-extern HWND hAmigaWnd;
 static int prtopen;
 extern void flushpixels(void);
 void DoSomeWeirdPrintingStuff(char val);
index 2f73ca63f92d56f16993cf982b73ddbecb24491e..f978c71112b3a6ee3c77906ba149f5c118382320 100755 (executable)
@@ -30,6 +30,8 @@
 *   programs started from a Picasso workbench.
 */
 
+#define P96DX 0
+
 #include "sysconfig.h"
 #include "sysdeps.h"
 
 
 #if defined(PICASSO96)
 
-#define NOBLITTER 0
-
-static int hwsprite = 0;
-static int uaegfxcard_old = 1;
-
 #include "registry.h"
 #include "dxwrap.h"
 #include "rp.h"
 #include "picasso96_win.h"
 #include "win32gfx.h"
 
+#define NOBLITTER 0
+#define NOBLITTER_BLIT 0
+
+static int hwsprite = 0;
+static int picasso96_BT = BT_uaegfx;
+static int picasso96_GCT = GCT_Unknown;
+static int picasso96_PCT = PCT_Unknown;
+#ifndef UAEGFX_INTERNAL
+static int uaegfxcard_old = 1;
+#endif
+
 int mman_GetWriteWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize, PVOID *lpAddresses, PULONG_PTR lpdwCount, PULONG lpdwGranularity);
 void mman_ResetWatch (PVOID lpBaseAddress, SIZE_T dwRegionSize);
 
@@ -94,6 +102,8 @@ struct picasso96_state_struct picasso96_state;
 struct picasso_vidbuf_description picasso_vidinfo;
 static struct PicassoResolution *newmodes;
 
+static int picasso_convert, host_mode;
+
 /* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */
 /* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects
 /* data here. */
@@ -105,6 +115,9 @@ static struct ScreenResolution alphacolour = { 640, 480 };
 
 uae_u32 p96_rgbx16[65536];
 
+#if P96DX > 0
+static LPDIRECTDRAWSURFACE7 p96surface;
+#endif
 static LPDIRECTDRAWSURFACE7 cursorsurface;
 static int cursorwidth, cursorheight;
 static uae_u32 cursorrgb[4], cursorrgbn[4];
@@ -184,7 +197,7 @@ static void endianswap (uae_u32 *vp, int bpp)
     switch (bpp)
     {
        case 2:
-       *vp = (((v >> 8) & 0xff) | (v << 8)) & 0xffff;
+       *vp = (((v >> 8) & 0x00ff) | (v << 8)) & 0xffff;
        break;
        case 4:
        *vp = ((v >> 24) & 0x000000ff) | ((v >> 8) & 0x0000ff00) | ((v << 8) & 0x00ff0000) | ((v << 24) & 0xff000000);
@@ -501,15 +514,15 @@ static int renderinfo_is_current_screen (struct RenderInfo *ri)
 /*
 * Fill a rectangle in the screen.
 */
-STATIC_INLINE void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y,
-                                           int Width, int Height, uae_u32 Pen, int Bpp)
+static void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y,
+                                   int Width, int Height, uae_u32 Pen, int Bpp)
 {
     int cols;
-    uae_u8 *src, *dst;
+    uae_u8 *dst;
     int lines;
     int bpr = ri->BytesPerRow;
 
-    dst = src = ri->Memory + X * Bpp + Y * ri->BytesPerRow;
+    dst = ri->Memory + X * Bpp + Y * ri->BytesPerRow;
     endianswap (&Pen, Bpp);
     switch (Bpp)
     {
@@ -530,11 +543,11 @@ STATIC_INLINE void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y
         break;
        case 3:
            for (lines = 0; lines < Height; lines++, dst += bpr) {
-               uae_u8 *d = (uae_u8*)dst;
+               uae_u8 *p = (uae_u8*)dst;
                for (cols = 0; cols < Width; cols++) {
-                   *d++ = Pen >> 16;
-                   *d++ = Pen >> 8;
-                   *d++ = Pen;
+                   *p++ = Pen >> 0;
+                   *p++ = Pen >> 8;
+                   *p++ = Pen >> 16;
                }
            }
        break;
@@ -644,6 +657,13 @@ void picasso_handle_vsync (void)
 {
     static int vsynccnt;
     
+#ifdef RETROPLATFORM
+    rp_vsync ();
+#endif
+
+    if (!picasso_on)
+       return;
+
     framecnt++;
     mouseupdate ();
     
@@ -663,6 +683,119 @@ void picasso_handle_vsync (void)
 
 static int set_panning_called = 0;
 
+
+typedef enum {
+
+    /* DEST = RGBFB_B8G8R8A8,32 */
+    RGBFB_A8R8G8B8_32 = 1,
+    RGBFB_A8B8G8R8_32,
+    RGBFB_R8G8B8A8_32,
+    RGBFB_B8G8R8A8_32,
+    RGBFB_R8G8B8_32,
+    RGBFB_B8G8R8_32,
+    RGBFB_R5G6B5PC_32,
+    RGBFB_R5G5B5PC_32,
+    RGBFB_R5G6B5_32,
+    RGBFB_R5G5B5_32,
+    RGBFB_B5G6R5PC_32,
+    RGBFB_B5G5R5PC_32,
+    RGBFB_CLUT_RGBFB_32,
+
+    /* DEST = RGBFB_R5G6B5PC,16 */
+    RGBFB_A8R8G8B8_16,
+    RGBFB_A8B8G8R8_16,
+    RGBFB_R8G8B8A8_16,
+    RGBFB_B8G8R8A8_16,
+    RGBFB_R8G8B8_16,
+    RGBFB_B8G8R8_16,
+    RGBFB_R5G6B5PC_16,
+    RGBFB_R5G5B5PC_16,
+    RGBFB_R5G6B5_16,
+    RGBFB_R5G5B5_16,
+    RGBFB_B5G6R5PC_16,
+    RGBFB_B5G5R5PC_16,
+    RGBFB_CLUT_RGBFB_16,
+
+    /* DEST = RGBFB_CLUT,8 */
+    RGBFB_CLUT_8
+};
+
+static void setconvert (void)
+{
+    int d = picasso_vidinfo.pixbytes;
+    int v;
+
+    v = 0;
+    switch (picasso96_state.RGBFormat)
+    {
+       case RGBFB_CLUT:
+       if (d == 1)
+           v = RGBFB_CLUT_8;
+       else if (d == 2)
+           v = RGBFB_CLUT_RGBFB_16;
+       else if (d == 4)
+           v = RGBFB_CLUT_RGBFB_32;
+       break;
+
+       case RGBFB_B5G6R5PC:
+       if (d == 2)
+           v = RGBFB_B5G6R5PC_16;
+       else if (d == 4)
+           v = RGBFB_B5G6R5PC_32;
+       break;
+       case RGBFB_R5G6B5PC:
+       if (d == 2)
+           v = RGBFB_R5G6B5PC_16;
+       else if (d == 4)
+           v = RGBFB_R5G6B5PC_32;
+       break;
+
+       case RGBFB_R5G5B5PC:
+       if (d == 4)
+           v = RGBFB_R5G5B5PC_32;
+       else if (d == 2)
+           v = RGBFB_R5G5B5PC_16;
+       break;
+       case RGBFB_R5G6B5:
+       if (d == 4)
+           v = RGBFB_R5G6B5_32;
+       break;
+       case RGBFB_R5G5B5:
+       if (d == 4)
+           v = RGBFB_R5G5B5_32;
+       break;
+       case RGBFB_B5G5R5PC:
+       if (d == 4)
+           v = RGBFB_B5G5R5PC_32;
+       break;
+
+
+       case RGBFB_R8G8B8:
+       if (d == 4)
+           v = RGBFB_R8G8B8_32;
+       break;
+       case RGBFB_B8G8R8:
+       if (d == 4)
+           v = RGBFB_B8G8R8_32;
+       break;
+       case RGBFB_A8B8G8R8:
+       if (d == 2)
+           v = RGBFB_A8B8G8R8_16;
+       else if (d == 4)
+           v = RGBFB_A8B8G8R8_32;
+       break;
+       case RGBFB_B8G8R8A8:
+       if (d == 2)
+           v = RGBFB_B8G8R8A8_16;
+       else if (d == 4)
+           v = RGBFB_B8G8R8A8_32;
+       break;
+    }
+    picasso_convert = v;
+    host_mode = DirectDraw_GetSurfacePixelFormat (NULL);
+    write_log ("RTG conversion: Depth=%d HostRGBF=%d P96RGBF=%d Mode=%d\n", d, host_mode, picasso96_state.RGBFormat, v);
+}
+
 /* Clear our screen, since we've got a new Picasso screen-mode, and refresh with the proper contents
 * This is called on several occasions:
 * 1. Amiga-->Picasso transition, via SetSwitch()
@@ -697,6 +830,7 @@ void picasso_refresh (void)
     } //end for higher P96 mousedraw rate
     have_done_picasso = 1;
     palette_changed = 1;
+    setconvert ();
 
     /* Make sure that the first time we show a Picasso video mode, we don't blit any crap.
     * We can do this by checking if we have an Address yet.  */
@@ -779,6 +913,57 @@ void picasso_refresh (void)
 #undef BLT_SIZE
 #undef BLT_MULT
 
+#define BLT_SIZE 3
+#define BLT_MULT 1
+#define BLT_NAME BLIT_FALSE_24
+#define BLT_FUNC(s,d) *d = 0
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NOR_24
+#define BLT_FUNC(s,d) *d = ~(*s | * d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_ONLYDST_24
+#define BLT_FUNC(s,d) *d = (*d) & ~(*s)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NOTSRC_24
+#define BLT_FUNC(s,d) *d = ~(*s)
+#include "p96_blit.c" 
+#define BLT_NAME BLIT_ONLYSRC_24
+#define BLT_FUNC(s,d) *d = (*s) & ~(*d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NOTDST_24
+#define BLT_FUNC(s,d) *d = ~(*d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_EOR_24
+#define BLT_FUNC(s,d) *d = (*s) ^ (*d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NAND_24
+#define BLT_FUNC(s,d) *d = ~((*s) & (*d))
+#include "p96_blit.c"
+#define BLT_NAME BLIT_AND_24
+#define BLT_FUNC(s,d) *d = (*s) & (*d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NEOR_24
+#define BLT_FUNC(s,d) *d = ~((*s) ^ (*d))
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NOTONLYSRC_24
+#define BLT_FUNC(s,d) *d = ~(*s) | (*d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_NOTONLYDST_24
+#define BLT_FUNC(s,d) *d = ~(*d) | (*s)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_OR_24
+#define BLT_FUNC(s,d) *d = (*s) | (*d)
+#include "p96_blit.c"
+#define BLT_NAME BLIT_TRUE_24
+#define BLT_FUNC(s,d) *d = 0xffffffff
+#include "p96_blit.c"
+#define BLT_NAME BLIT_30_24
+#define BLT_FUNC(s,d) tmp = *d ; *d = *s; *s = tmp;
+#define BLT_TEMP
+#include "p96_blit.c"
+#undef BLT_SIZE
+#undef BLT_MULT
+
 #define BLT_SIZE 2
 #define BLT_MULT 2
 #define BLT_NAME BLIT_FALSE_16
@@ -894,7 +1079,6 @@ static int do_blitrect_frame_buffer (struct RenderInfo *ri, struct
     uae_u8 *src, *dst;
     uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat);
     unsigned long total_width = width * Bpp;
-    unsigned long linewidth = (total_width + 15) & ~15;
 
     src = ri->Memory + srcx * Bpp + srcy * ri->BytesPerRow;
     dst = dstri->Memory + dstx * Bpp + dsty * dstri->BytesPerRow;
@@ -945,6 +1129,27 @@ static int do_blitrect_frame_buffer (struct RenderInfo *ri, struct
                case BLIT_TRUE: BLIT_TRUE_32 (PARMS); break;
                case 30: BLIT_30_32 (PARMS); break;
            }
+       } else if (Bpp == 3) {
+
+           /* 24-bit (not very) optimized */
+           switch (opcode)
+           {
+               case BLIT_FALSE: BLIT_FALSE_24 (PARMS); break;
+               case BLIT_NOR: BLIT_NOR_24 (PARMS); break;
+               case BLIT_ONLYDST: BLIT_ONLYDST_24 (PARMS); break;
+               case BLIT_NOTSRC: BLIT_NOTSRC_24 (PARMS); break;
+               case BLIT_ONLYSRC: BLIT_ONLYSRC_24 (PARMS); break;
+               case BLIT_NOTDST: BLIT_NOTDST_24 (PARMS); break;
+               case BLIT_EOR: BLIT_EOR_24 (PARMS); break;
+               case BLIT_NAND: BLIT_NAND_24 (PARMS); break;
+               case BLIT_AND: BLIT_AND_24 (PARMS); break;
+               case BLIT_NEOR: BLIT_NEOR_24 (PARMS); break;
+               case BLIT_NOTONLYSRC: BLIT_NOTONLYSRC_24 (PARMS); break;
+               case BLIT_NOTONLYDST: BLIT_NOTONLYDST_24 (PARMS); break;
+               case BLIT_OR: BLIT_OR_24 (PARMS); break;
+               case BLIT_TRUE: BLIT_TRUE_24 (PARMS); break;
+               case 30: BLIT_30_24 (PARMS); break;
+           }
        
        } else if (Bpp == 2) {
 
@@ -1151,21 +1356,9 @@ void picasso_clearcursor (void)
        write_log ("Cursor surface clearblit failed: %s\n", DXError (ddrval));
 }
 
-static void putmousepixel (uae_u8 *d, int bpp, int idx)
+STATIC_INLINE uae_u16 rgb32torgb16pc (uae_u32 rgb)
 {
-    uae_u32 val = cursorrgbn[idx];
-    switch (bpp)
-    {
-       case 1:
-       ((uae_u8*)d)[0] = (uae_u8)val;
-       break;
-       case 2:
-       ((uae_u16*)d)[0] = (uae_u16)val;
-       break;
-       case 4:
-       ((uae_u32*)d)[0] = (uae_u32)val;
-       break;
-    }
+    return (((rgb >> (16 + 3)) & 0x1f) << 11) | (((rgb >> (8 + 2)) & 0x3f) << 5) | (((rgb >> (0 + 3)) & 0x1f) << 0);
 }
 
 static void updatesprcolors (void)
@@ -1182,9 +1375,9 @@ static void updatesprcolors (void)
            cursorrgbn[i] = i + 16;
            break;
            case 2:
-           vx = 0xff00ff;
-           cursorrgbn[0] = p96_rgbx16[(((vx >> (16 + 3)) & 0x1f) << 11) | (((vx >> (8 + 2)) & 0x3f) << 5) | (((vx >> (0 + 3)) & 0x1f) << 0)];
-           cursorrgbn[i] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)];
+           vx = 0xff00ff; /* RGB -> B5G6R5 */
+           cursorrgbn[0] = rgb32torgb16pc (vx);
+           cursorrgbn[i] = rgb32torgb16pc (v);
            break;
            case 4:
            cursorrgbn[0] = 0xff00ff;
@@ -1194,6 +1387,23 @@ static void updatesprcolors (void)
     }
 }
 
+static void putmousepixel (uae_u8 *d, int bpp, int idx)
+{
+    uae_u32 val = cursorrgbn[idx];
+    switch (bpp)
+    {
+       case 1:
+       ((uae_u8*)d)[0] = (uae_u8)val;
+       break;
+       case 2:
+       ((uae_u16*)d)[0] = (uae_u16)val;
+       break;
+       case 4:
+       ((uae_u32*)d)[0] = (uae_u32)val;
+       break;
+    }
+}
+
 static uae_u32 setspriteimage (uaecptr bi)
 {
     DDSURFACEDESC2 desc;
@@ -1441,21 +1651,23 @@ static uae_u32 REGPARAM2 picasso_FindCard (TrapContext *ctx)
        return 0;
 }
 
-static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struct PicassoResolution *dm)
+static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struct PicassoResolution *dm, int depth)
 {
     int i;
 
-    switch (dm->depth) {
-    case 1:
+    switch (depth)
+    {
+       case 8:
        res->Modes[CHUNKY] = amigamemptr;
        break;
-    case 2:
+       case 15:
+       case 16:
        res->Modes[HICOLOR] = amigamemptr;
        break;
-    case 3:
+       case 24:
        res->Modes[TRUECOLOR] = amigamemptr;
        break;
-    default:
+       default:
        res->Modes[TRUEALPHA] = amigamemptr;
        break;
     }
@@ -1464,7 +1676,7 @@ static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struc
 
     put_word (amigamemptr + PSSO_ModeInfo_Width, dm->res.width);
     put_word (amigamemptr + PSSO_ModeInfo_Height, dm->res.height);
-    put_byte (amigamemptr + PSSO_ModeInfo_Depth, dm->depth * 8);
+    put_byte (amigamemptr + PSSO_ModeInfo_Depth, depth);
     put_byte (amigamemptr + PSSO_ModeInfo_Flags, 0);
     put_word (amigamemptr + PSSO_ModeInfo_HorTotal, dm->res.width);
     put_word (amigamemptr + PSSO_ModeInfo_HorBlankSize, 0);
@@ -1588,6 +1800,23 @@ static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr
     put_long (amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo);
 }
 
+static int p96depth (int depth)
+{
+    uae_u32 f = currprefs.picasso96_modeflags;
+    int ok = 0;
+
+    if (depth == 8 && (f & RGBFF_CLUT))
+       ok = 1;
+    if (depth == 15 && (f & (RGBFF_R5G5B5PC | RGBFF_R5G5B5 | RGBFF_B5G5R5PC)))
+       ok = 2;
+    if (depth == 16 && (f & (RGBFF_R5G6B5PC | RGBFF_R5G6B5 | RGBFF_B5G6R5PC)))
+       ok = 2;
+    if (depth == 24 && (f & (RGBFF_R8G8B8 | RGBFF_B8G8R8)))
+       ok = 3;
+    if (depth == 32 && (f & (RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8)))
+       ok = 4;
+    return ok;
+}
 
 static int missmodes[] = { 320, 200, 320, 240, 640, 400, 640, 480, -1 };
 
@@ -1597,7 +1826,7 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 size);
 void picasso96_alloc (TrapContext *ctx)
 {
     int i, j, size, cnt;
-    int misscnt;
+    int misscnt, depths;
     SYSTEM_INFO si;
 
     uaegfx_resname = ds ("uaegfx.card");
@@ -1610,6 +1839,19 @@ void picasso96_alloc (TrapContext *ctx)
     cnt = 0;
     newmodes = xmalloc (sizeof (struct PicassoResolution) * MAX_PICASSO_MODES);
     size = 0;
+
+    depths = 0;
+    if (p96depth (8))
+       depths++;
+    if (p96depth (15))
+       depths++;
+    if (p96depth (16))
+       depths++;
+    if (p96depth (24))
+       depths++;
+    if (p96depth (32))
+       depths++;
+
     i = 0;
     while (DisplayModes[i].depth >= 0) {
        for (j = 0; missmodes[j * 2] >= 0; j++) {
@@ -1628,72 +1870,73 @@ void picasso96_alloc (TrapContext *ctx)
        while (missmodes[misscnt * 2] == 0)
            misscnt++;
        if (missmodes[misscnt * 2] >= 0) {
-           int oldi = i;
            if (DisplayModes[i].res.width > missmodes[misscnt * 2 + 0] || DisplayModes[i].res.height > missmodes[misscnt * 2 + 1]) {
+               int depth;
                int w = DisplayModes[i].res.width;
                int h = DisplayModes[i].res.height;
-               do {
+               for (depth = 8; depth <= 32; depth++) {
                    struct PicassoResolution *pr = &newmodes[cnt];
+                   if (!p96depth (depth))
+                       continue;
                    memcpy (pr, &DisplayModes[i], sizeof (struct PicassoResolution));
                    pr->res.width = missmodes[misscnt * 2 + 0];
                    pr->res.height = missmodes[misscnt * 2 + 1];
-                   sprintf (pr->name, "%dx%dx%d FAKE", pr->res.width, pr->res.height, pr->depth * 8);
+                   sprintf (pr->name, "%dx%dx%d FAKE", pr->res.width, pr->res.height, depth);
                    size += PSSO_ModeInfo_sizeof;
-                   i++;
-                   cnt++;
-               } while (DisplayModes[i].depth >= 0
-                   && w == DisplayModes[i].res.width
-                   && h == DisplayModes[i].res.height);
-           
-               i = oldi;
+               }
                misscnt++;
                continue;
            }
        }
-       do {
-           memcpy (&newmodes[cnt], &DisplayModes[i], sizeof (struct PicassoResolution));
-           size += PSSO_ModeInfo_sizeof;
-           i++;
-           cnt++;
-       } while (DisplayModes[i].depth >= 0
+        memcpy (&newmodes[cnt], &DisplayModes[i], sizeof (struct PicassoResolution));
+        size += PSSO_ModeInfo_sizeof * depths;
+        i++;
+        cnt++;
+       while (DisplayModes[i].depth >= 0
            && DisplayModes[i].res.width == DisplayModes[j].res.width
-           && DisplayModes[i].res.height == DisplayModes[j].res.height);
+           && DisplayModes[i].res.height == DisplayModes[j].res.height)
+               i++;
     }
     newmodes[cnt].depth = -1;
 
     for (i = 0; i < cnt; i++) {
-       switch (newmodes[i].depth) {
-       case 1:
-           if (newmodes[i].res.width > chunky.width)
-               chunky.width = newmodes[i].res.width;
-           if (newmodes[i].res.height > chunky.height)
-               chunky.height = newmodes[i].res.height;
-           break;
-       case 2:
-           if (newmodes[i].res.width > hicolour.width)
-               hicolour.width = newmodes[i].res.width;
-           if (newmodes[i].res.height > hicolour.height)
-               hicolour.height = newmodes[i].res.height;
-           break;
-       case 3:
-           if (newmodes[i].res.width > truecolour.width)
-               truecolour.width = newmodes[i].res.width;
-           if (newmodes[i].res.height > truecolour.height)
-               truecolour.height = newmodes[i].res.height;
-           break;
-       case 4:
-           if (newmodes[i].res.width > alphacolour.width)
-               alphacolour.width = newmodes[i].res.width;
-           if (newmodes[i].res.height > alphacolour.height)
-               alphacolour.height = newmodes[i].res.height;
-           break;
+       int depth;
+       for (depth = 8; depth <= 32; depth++) {
+           if (!p96depth (depth))
+               continue;
+           switch (depth) {
+           case 1:
+               if (newmodes[i].res.width > chunky.width)
+                   chunky.width = newmodes[i].res.width;
+               if (newmodes[i].res.height > chunky.height)
+                   chunky.height = newmodes[i].res.height;
+               break;
+           case 2:
+               if (newmodes[i].res.width > hicolour.width)
+                   hicolour.width = newmodes[i].res.width;
+               if (newmodes[i].res.height > hicolour.height)
+                   hicolour.height = newmodes[i].res.height;
+               break;
+           case 3:
+               if (newmodes[i].res.width > truecolour.width)
+                   truecolour.width = newmodes[i].res.width;
+               if (newmodes[i].res.height > truecolour.height)
+                   truecolour.height = newmodes[i].res.height;
+               break;
+           case 4:
+               if (newmodes[i].res.width > alphacolour.width)
+                   alphacolour.width = newmodes[i].res.width;
+               if (newmodes[i].res.height > alphacolour.height)
+                   alphacolour.height = newmodes[i].res.height;
+               break;
+           }
        }
     }
 #if 0
     ShowSupportedResolutions ();
 #endif
 #ifdef UAEGFX_INTERNAL
-    picasso96_amem = NULL;
+    picasso96_amem = 0;
     if (uaegfx_card_install (ctx, size)) {
        picasso96_amem = get_long (uaegfx_base + CARD_RESLIST);
        picasso96_amemend = picasso96_amem + size;
@@ -1758,6 +2001,12 @@ static void uaegfxversion (uaecptr bi)
                    vers[strlen (vers) - 1] = 0;
 
                write_log ("P96: v%d %08X %s\n", version, addr, vers);
+               if (version == 1) {
+                   static int warned;
+                   if (!warned)
+                       gui_message("Buggy libs:picasso96/uaegfx.card detected.\nPlease replace it with official version.\n");
+                   warned = 1;
+               }
                if (version >= 2)
                    uaegfxcard_old = 0;
                xfree (vers);
@@ -1775,11 +2024,12 @@ static void inituaegfx (uaecptr ABI)
 {
     uae_u32 flags;
 
+    write_log ("RTG mode mask: %x\n", currprefs.picasso96_modeflags);
     put_word (ABI + PSSO_BoardInfo_BitsPerCannon, 8);
-    put_word (ABI + PSSO_BoardInfo_RGBFormats, picasso96_pixel_format);
-    put_long (ABI + PSSO_BoardInfo_BoardType, BT_uaegfx);
-    put_long (ABI + PSSO_BoardInfo_GraphicsControllerType, GCT_Unknown);
-    put_long (ABI + PSSO_BoardInfo_PaletteChipType, PCT_Unknown);
+    put_word (ABI + PSSO_BoardInfo_RGBFormats, currprefs.picasso96_modeflags);
+    put_long (ABI + PSSO_BoardInfo_BoardType, picasso96_BT);
+    put_long (ABI + PSSO_BoardInfo_GraphicsControllerType, picasso96_GCT);
+    put_long (ABI + PSSO_BoardInfo_PaletteChipType, picasso96_PCT);
     put_long (ABI + PSSO_BoardInfo_BoardName, uaegfx_resname);
     put_long (ABI + PSSO_BoardInfo_BoardType, 1);
 
@@ -1804,10 +2054,8 @@ static void inituaegfx (uaecptr ABI)
 
     flags = get_long (ABI + PSSO_BoardInfo_Flags);
     flags &= 0xffff0000;
-    flags |= BIF_HARDWARESPRITE | BIF_BLITTER | BIF_NOMEMORYMODEMIX;
-    put_long (ABI + PSSO_BoardInfo_Flags, flags);
+    flags |= BIF_BLITTER | BIF_NOMEMORYMODEMIX;
 #ifndef UAEGFX_INTERNAL
-    flags = get_long (ABI + PSSO_BoardInfo_Flags);
     if (flags & BIF_HARDWARESPRITE) {
        hwsprite = 1;
        put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, 0);
@@ -1815,7 +2063,7 @@ static void inituaegfx (uaecptr ABI)
     } else {
        hwsprite = 0;
        write_log ("P96: uaegfx.card: no hardware sprite support\n");
-       put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, picasso96_pixel_format);
+       put_word (ABI + PSSO_BoardInfo_SoftSpriteFlags, currprefs.picasso96_modeflags);
     }
     if (uaegfxcard_old && (flags & BIF_HARDWARESPRITE)) {
        flags &= ~BIF_HARDWARESPRITE;
@@ -1823,8 +2071,11 @@ static void inituaegfx (uaecptr ABI)
     }
     if (!(flags & BIF_BLITTER))
        write_log ("P96: no blitter support, bogus uaegfx.card!?\n");
-    put_long (ABI + PSSO_BoardInfo_Flags, flags);
+#else
+    hwsprite = 1;
+    flags |= BIF_HARDWARESPRITE;
 #endif
+    put_long (ABI + PSSO_BoardInfo_Flags, flags);
     if (flags & BIF_NOBLITTER)
        write_log ("P96: blitter disabled in devs:monitors/uaegfx!\n");
 
@@ -1872,6 +2123,7 @@ static uae_u32 REGPARAM2 picasso_InitCard (TrapContext *ctx)
     i = 0;
     unkcnt = 0;
     while (newmodes[i].depth >= 0) {
+       int depth;
        j = i;
        /* Add a LibResolution structure to the ResolutionsList MinList in our BoardInfo */
        res.DisplayID = AssignModeID (i, LibResolutionStructureCount, &unkcnt);
@@ -1880,25 +2132,28 @@ static uae_u32 REGPARAM2 picasso_InitCard (TrapContext *ctx)
        res.Height = newmodes[i].res.height;
        res.Flags = P96F_PUBLIC;
        memcpy (res.P96ID, "P96-0:", 6);
-       sprintf (res.Name, "uaegfx:%dx%d", res.Width, res.Height);
+       sprintf (res.Name, "UAE:%dx%d", res.Width, res.Height);
        res.Modes[PLANAR] = 0;
        res.Modes[CHUNKY] = 0;
        res.Modes[HICOLOR] = 0;
        res.Modes[TRUECOLOR] = 0;
        res.Modes[TRUEALPHA] = 0;
 
-       do {
+       for (depth = 8; depth <= 32; depth++) {
+           if (!p96depth (depth))
+               continue;
            /* Handle this display mode's depth */
            /* New: Only add the modes when there is enough P96 RTG memory to hold the bitmap */
-           if(allocated_gfxmem >= newmodes[i].res.width * newmodes[i].res.height * newmodes[i].depth) {
+           if(allocated_gfxmem >= newmodes[i].res.width * newmodes[i].res.height * (depth + 7) / 8) {
                ModeInfoStructureCount++;
-               FillBoardInfo(amem, &res, &newmodes[i]);
+               FillBoardInfo (amem, &res, &newmodes[i], depth);
                amem += PSSO_ModeInfo_sizeof;
            }
-           i++;
-       while (newmodes[i].depth >= 0
+       }
+       while (newmodes[i].depth >= 0
            && newmodes[i].res.width == newmodes[j].res.width
-           && newmodes[i].res.height == newmodes[j].res.height);
+           && newmodes[i].res.height == newmodes[j].res.height)
+               i++;
 
        LibResolutionStructureCount++;
        CopyLibResolutionStructureU2A (&res, amem);
@@ -2022,8 +2277,7 @@ static uae_u32 REGPARAM2 picasso_SetDAC (TrapContext *ctx)
     return 1;
 }
 
-
-static void init_picasso_screen(void)
+static void init_picasso_screen (void)
 {
     reloadcursor = 1;
     if(set_panning_called) {
@@ -2042,6 +2296,7 @@ static void init_picasso_screen(void)
     }
     init_picasso_screen_called = 1;
     mman_ResetWatch (p96ram_start + natmem_offset, allocated_gfxmem);
+
 }
 
 /*
@@ -2124,13 +2379,27 @@ static uae_u32 REGPARAM2 picasso_SetPanning (TrapContext *ctx)
     uaecptr bi = m68k_areg (regs, 0);
     uaecptr bmeptr = get_long (bi + PSSO_BoardInfo_BitMapExtra);  /* Get our BoardInfo ptr's BitMapExtra ptr */
     uae_u16 bme_width, bme_height;
+    int changed = 0;
 
     if(oldscr == 0) {
        oldscr = start_of_screen;
+       changed = 1;
     }
     if (oldscr != start_of_screen) {
        set_gc_called = 0;
        oldscr = start_of_screen;
+       changed = 1;
+    }
+
+    if (changed) {
+#if P96DX > 0
+       freesurface (p96surface);
+       p96surface = NULL;
+       if (picasso96_state.BytesPerPixel == picasso_vidinfo.pixbytes)
+           p96surface = createsurface (get_real_address (picasso96_state.Address),
+               picasso96_state.Width * picasso96_state.BytesPerPixel, picasso96_state.Width, picasso96_state.Height);
+       write_log ("P96Surface: %08X %p\n", picasso96_state.Address, p96surface);
+#endif
     }
 
     bme_width = get_word (bmeptr + PSSO_BitMapExtra_Width);
@@ -2225,10 +2494,8 @@ static uae_u32 REGPARAM2 picasso_InvertRect (TrapContext *ctx)
        width_in_bytes = Bpp * Width;
        rectstart = uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp;
 
-       for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow) {
+       for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow)
            do_xor8 (uae_mem, width_in_bytes, xorval);
-       }
-
        result = 1;
     }
 
@@ -2267,9 +2534,6 @@ static uae_u32 REGPARAM2 picasso_FillRect (TrapContext *ctx)
     if (NOBLITTER)
        return 0;
     if (CopyRenderInfoStructureA2U (renderinfo, &ri) && Y != 0xFFFF) {
-       if (ri.RGBFormat != RGBFormat)
-           write_log ("Weird Stuff!\n");
-
        Bpp = GetBytesPerPixel (RGBFormat);
 
        P96TRACE(("FillRect(%d, %d, %d, %d) Pen 0x%x BPP %d BPR %d Mask 0x%x\n",
@@ -2364,8 +2628,6 @@ STATIC_INLINE int BlitRectHelper (void)
     BLIT_OPCODE opcode = blitrectdata.opcode;
 
     uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat);
-    unsigned long total_width = width * Bpp;
-    unsigned long linewidth = (total_width + 15) & ~15;
 
     if (opcode == BLIT_DST) {
        write_log ( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" );
@@ -2441,7 +2703,7 @@ static uae_u32 REGPARAM2 picasso_BlitRect (TrapContext *ctx)
     uae_u8  Mask = (uae_u8)m68k_dreg (regs, 6);
     uae_u32 result = 0;
 
-    if (NOBLITTER)
+    if (NOBLITTER_BLIT)
        return 0;
     P96TRACE(("BlitRect(%d, %d, %d, %d, %d, %d, 0x%x)\n", srcx, srcy, dstx, dsty, width, height, Mask));
     result = BlitRect (renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC);
@@ -2481,7 +2743,7 @@ static uae_u32 REGPARAM2 picasso_BlitRectNoMaskComplete (TrapContext *ctx)
     uae_u32 RGBFmt = m68k_dreg (regs, 7);
     uae_u32 result = 0;
 
-    if (NOBLITTER)
+    if (NOBLITTER_BLIT)
        return 0;
 
     P96TRACE(("BlitRectNoMaskComplete() op 0x%02x, %08x:(%4d,%4d) --> %08x:(%4d,%4d), wh(%4d,%4d)\n",
@@ -2504,9 +2766,9 @@ STATIC_INLINE void PixelWrite (uae_u8 *mem, int bits, uae_u32 fgpen, int Bpp, ua
            ((uae_u16 *)mem)[bits] = (uae_u16)fgpen;
            break;
        case 3:
-           mem[bits + 0] = fgpen >> 16;
-           mem[bits + 1] = fgpen >> 8;
-           mem[bits + 2] = fgpen >> 0;
+           mem[bits * 3 + 0] = fgpen >> 0;
+           mem[bits * 3 + 1] = fgpen >> 8;
+           mem[bits * 3 + 2] = fgpen >> 16;
            break;
        case 4:
            ((uae_u32 *)mem)[bits] = fgpen;
@@ -2558,7 +2820,8 @@ static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx)
     uae_u32 result = 0;
 
     if (NOBLITTER)
-       return 0;
+       return 1;
+
     if(CopyRenderInfoStructureA2U (rinf, &ri) && CopyPatternStructureA2U (pinf, &pattern)) {
        Bpp = GetBytesPerPixel(ri.RGBFormat);
        uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset with address */
@@ -2600,7 +2863,7 @@ static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx)
                if (xshift != 0)
                    d = (d << xshift) | (d >> (16 - xshift));
 
-               for (cols = 0; cols < W; cols += 16, uae_mem2 += Bpp << 4) {
+               for (cols = 0; cols < W; cols += 16, uae_mem2 += Bpp * 16) {
                    long bits;
                    long max = W - cols;
                    unsigned int data = d;
@@ -2655,7 +2918,7 @@ static uae_u32 REGPARAM2 picasso_BlitPattern (TrapContext *ctx)
                                        case 3:
                                        {
                                            uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3);
-                                           do_put_mem_long (addr, do_get_mem_long (addr) ^ 0xffffff);
+                                           do_put_mem_long (addr, do_get_mem_long (addr) ^ 0x00ffffff);
                                        }
                                        break;
                                        case 4:
@@ -2719,8 +2982,9 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx)
 
     if (NOBLITTER)
        return 0;
+
     if (CopyRenderInfoStructureA2U (rinf, &ri) && CopyTemplateStructureA2U (tmpl, &tmp)) {
-       Bpp = GetBytesPerPixel(ri.RGBFormat);
+       Bpp = GetBytesPerPixel (ri.RGBFormat);
        uae_mem = ri.Memory + Y * ri.BytesPerRow + X * Bpp; /* offset into address */
 
        if (tmp.DrawMode & INVERS)
@@ -2731,7 +2995,6 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx)
        if (Mask != 0xFF) {
            if(Bpp > 1)
                Mask = 0xFF;
-
            if(tmp.DrawMode == COMP) {
                write_log ("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask);
                return 0;
@@ -2767,7 +3030,7 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx)
                uae_u8 *uae_mem2 = uae_mem;
                unsigned int data = *tmpl_mem;
 
-               for (cols = 0; cols < W; cols += 8, uae_mem2 += Bpp << 3) {
+               for (cols = 0; cols < W; cols += 8, uae_mem2 += Bpp * 8) {
                    unsigned int byte;
                    long bits;
                    long max = W - cols;
@@ -2790,7 +3053,7 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx)
                                if (inversion)
                                    bit_set = !bit_set;
                                if (bit_set)
-                                   PixelWrite(uae_mem2, bits, fgpen, Bpp, Mask);
+                                   PixelWrite (uae_mem2, bits, fgpen, Bpp, Mask);
                            }
                            break;
                        }
@@ -2801,7 +3064,7 @@ static uae_u32 REGPARAM2 picasso_BlitTemplate (TrapContext *ctx)
                                byte <<= 1;
                                if (inversion)
                                    bit_set = !bit_set;
-                               PixelWrite(uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask);
+                               PixelWrite (uae_mem2, bits, bit_set ? fgpen : bgpen, Bpp, Mask);
                            }
                            break;
                        }
@@ -2889,9 +3152,6 @@ void picasso_handle_hsync (void)
 {
     static int p96hsync;
 
-#ifdef RETROPLATFORM
-    rp_hsync ();
-#endif
     if (currprefs.gfxmem_size == 0)
        return;
     if (WIN32GFX_IsPicassoScreen () && currprefs.gfx_pfullscreen && currprefs.gfx_pvsync) {
@@ -2903,7 +3163,8 @@ void picasso_handle_hsync (void)
     if (p96hsync <= 0) {
        if (uae_boot_rom) {
            int off = get_long (rtarea_base + 36) + 12 - 1;
-           rtarea[off]++;
+           if (off >= 0 && off < 0x10000)
+               rtarea[off]++;
        }
        p96hsync = p96syncrate;
     }
@@ -2936,9 +3197,6 @@ static void PlanarToChunky (struct RenderInfo *ri, struct BitMap *bm,
     unsigned long rows, bitoffset = srcx & 7;
     long eol_offset;
 
-    /* if (mask != 0xFF)
-    write_log ("P2C - pixel-width = %d, bit-offset = %d\n", width, bitoffset); */
-
     /* Set up our bm->Planes[] pointers to the right horizontal offset */
     for (j = 0; j < Depth; j++) {
        uae_u8 *p = bm->Planes[j];
@@ -3094,9 +3352,10 @@ static void PlanarToDirect (struct RenderInfo *ri, struct BitMap *bm,
                    image2 += 2;
                break;
                case 3:
-                   do_put_mem_byte (image2++, (uae_u8)cim->Colors[v] );
-                   do_put_mem_word ((uae_u16 *)image2, (uae_u16)((cim->Colors[v] & 0x00FFFF00) >> 8));
-                   image2 += 2;
+                   image2[0] = cim->Colors[v] >> 0;
+                   image2[1] = cim->Colors[v] >> 8;
+                   image2[2] = cim->Colors[v] >> 16;
+                   image2 += 3;
                break;
                case 4:
                    ((uae_u32 *)image2)[0] = cim->Colors[v];
@@ -3188,10 +3447,160 @@ static uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (TrapContext *ctx)
     return result;
 }
 
+STATIC_INLINE void copyrow (uae_u8 *src, uae_u8 *dst, int x, int y, int width)
+{
+    uae_u8 *src2 = src + y * picasso96_state.BytesPerRow;
+    uae_u8 *dst2 = dst + y * picasso_vidinfo.rowbytes;
+    int endx = x + width;
+    int dstpix = picasso_vidinfo.pixbytes;
+    int srcpix = picasso96_state.BytesPerPixel;
+
+    if (picasso96_state.RGBFormat == host_mode) {
+        memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
+        return;
+    }
+
+    switch (picasso_convert)
+    {
+       case RGBFB_B8G8R8A8_32:
+       case RGBFB_B5G6R5PC_16:
+       case RGBFB_R5G6B5PC_16:
+       case RGBFB_CLUT_8:
+           memcpy (dst2 + x * dstpix, src2 + x * srcpix, width * dstpix);
+       break;
+
+       case RGBFB_R8G8B8_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = (src2[x * 3 + 0] << 16) | (src2[x * 3 + 1] << 8) | (src2[x * 3 + 2] << 0);
+               x++;
+           }
+       break;
+       case RGBFB_B8G8R8_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = ((uae_u32*)(src2 + x * 3))[0] & 0x00ffffff;
+               x++;
+           }
+       break;
+       case RGBFB_R8G8B8A8_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = (src2[x * 4 + 0] << 16) | (src2[x * 4 + 1] << 8) | (src2[x * 4 + 2] << 0);
+               x++;
+           }
+       break;
+       case RGBFB_A8R8G8B8_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = (src2[x * 4 + 1] << 16) | (src2[x * 4 + 2] << 8) | (src2[x * 4 + 3] << 0);
+               x++;
+           }
+       break;
+       case RGBFB_A8B8G8R8_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = ((uae_u32*)src2)[0] << 8;
+               x++;
+           }
+       break;
+
+       case RGBFB_R5G6B5PC_32:
+       case RGBFB_R5G5B5PC_32:
+       case RGBFB_R5G6B5_32:
+       case RGBFB_R5G5B5_32:
+       case RGBFB_B5G6R5PC_32:
+       case RGBFB_B5G5R5PC_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+               ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+               ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+               ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+           }
+       break;
+
+       case RGBFB_R5G5B5PC_16:
+       case RGBFB_R5G6B5_16:
+       case RGBFB_R5G5B5_16:
+       case RGBFB_B5G5R5PC_16:
+           while (x < endx) {
+               ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+               ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+               ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+               ((uae_u16*)dst2)[x] = (uae_u16)p96_rgbx16[((uae_u16*)src2)[x]];
+               x++;
+           }
+       break;
+
+       case RGBFB_R8G8B8_16:
+       break;
+       case RGBFB_B8G8R8_16:
+       break;
+       case RGBFB_R8G8B8A8_16:
+       break;
+       case RGBFB_A8R8G8B8_16:
+       break;
+       case RGBFB_A8B8G8R8_16:
+       break;
+
+       case RGBFB_B8G8R8A8_16:
+           while (x < endx) {
+               uae_u32 v;
+               v = ((uae_u32*)src2)[x];
+               ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)];
+               x++;
+           }
+       break;
+
+       case RGBFB_CLUT_RGBFB_32:
+           while (x < endx) {
+               ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+               ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+               ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+               ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+           }
+       break;
+       case RGBFB_CLUT_RGBFB_16:
+           while (x < endx) {
+               ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+               ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+               ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+               ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
+               x++;
+           }
+       break;
+    }
+}
+
+static void copyall (uae_u8 *src, uae_u8 *dst)
+{
+    int y;
+
+    if (picasso96_state.RGBFormat == host_mode) {
+       int w = picasso96_state.Width * picasso_vidinfo.pixbytes;
+       for (y = 0; y < picasso96_state.Height; y++) {
+           memcpy (dst, src, w);
+           dst += picasso_vidinfo.rowbytes;
+           src += picasso96_state.BytesPerRow;
+       }
+    } else {
+       for (y = 0; y < picasso96_state.Height; y++)
+           copyrow (src, dst, 0, y, picasso96_state.Width);
+    }
+}
+
 static void flushpixels (void)
 {
     int i;
-    int rowwidth_dst = picasso_vidinfo.width * picasso_vidinfo.pixbytes;
     int rowwidth_src = picasso96_state.Width * picasso96_state.BytesPerPixel;
     uae_u8 *src = p96ram_start + natmem_offset;
     int off = picasso96_state.XYOffset - gfxmem_start;
@@ -3203,6 +3612,7 @@ static void flushpixels (void)
     uae_u8 *dst = NULL;
     ULONG_PTR gwwcnt;
 
+
     if (!picasso_vidinfo.extra_mem || !gwwbuf || src_start >= src_end)
        return;
 
@@ -3210,6 +3620,7 @@ static void flushpixels (void)
        palette_changed = -1;
 
     for (;;) {
+       int dofull;
 
        gwwcnt = 0;
 
@@ -3228,13 +3639,22 @@ static void flushpixels (void)
        } else {
            ULONG ps;
            gwwcnt = gwwbufsize;
-           if (mman_GetWriteWatch (src, allocated_gfxmem, gwwbuf, &gwwcnt, &ps))
+           if (mman_GetWriteWatch (src_start, src_end - src_start, gwwbuf, &gwwcnt, &ps))
                break;
        }
 
        if (gwwcnt == 0)
            break;
 
+       dofull = gwwcnt >= ((src_end - src_start) / gwwpagesize) * 80 / 100;
+
+#if P96DX > 0
+       if (p96surface && dofull && picasso_vidinfo.pixbytes == picasso96_state.BytesPerPixel) {
+           flushpixels_surface (gwwbuf, gwwcnt, src_start, src_end);
+           return;
+       }
+#endif
+
        if (dst == NULL) {
            if (DirectDraw_IsLocked() == FALSE) {
                if (!lock)
@@ -3250,13 +3670,18 @@ static void flushpixels (void)
        if (doskip () && p96skipmode == 2)
            break;
 
+       if (dofull) {
+           copyall (src + off, dst);
+           miny = 0;
+           maxy = picasso96_state.Height;
+           break;
+       }
+
        for (i = 0; i < gwwcnt; i++) {
-           int pscnt = gwwpagesize;
            uae_u8 *p = gwwbuf[i];
 
            if (p >= src_start && p < src_end) {
-               int y, yend, realoffset;
-               uae_u8 *src2, *dst2;
+               int y, x, realoffset;
 
                if (p >= src + off) {
                    realoffset = p - (src + off);
@@ -3265,106 +3690,25 @@ static void flushpixels (void)
                }
 
                y = realoffset / picasso96_state.BytesPerRow;
-               src2 = src + y * picasso96_state.BytesPerRow + off;
-               dst2 = dst + y * picasso_vidinfo.rowbytes;
-
-               /* merge nearby pieces */
-               while (i + 1 < gwwcnt && (uae_u8*)gwwbuf[i + 1] <= p + 1 * gwwpagesize) {
-                   pscnt += gwwpagesize;
-                   p += gwwpagesize;
-                   i++;
-               }
-
-               yend = (realoffset + pscnt + picasso96_state.BytesPerRow - 1) / picasso96_state.BytesPerRow;
-               if (yend >= picasso96_state.Height)
-                  yend = picasso96_state.Height - 1;
-
-               if (yend > maxy)
-                   maxy = yend;
-               if (y < miny)
-                   miny = y;
-
-               if (picasso_vidinfo.pixbytes == picasso96_state.BytesPerPixel) {
-                   while (y <= yend) {
-                       memcpy (dst2, src2, rowwidth_dst);
-                       src2 += picasso96_state.BytesPerRow;
-                       dst2 += picasso_vidinfo.rowbytes;
-                       y++;
-                   }
-               } else if (picasso_vidinfo.pixbytes == 4 && picasso96_state.BytesPerPixel == 2) { /* 16->32 */
-                   int x;
-                   while (y <= yend) {
-                       for (x = 0; x < picasso96_state.Width;) {
-                           ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
-                           x++;
-                           ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
-                           x++;
-                           ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
-                           x++;
-                           ((uae_u32*)dst2)[x] = p96_rgbx16[((uae_u16*)src2)[x]];
-                           x++;
-                       }
-                       src2 += picasso96_state.BytesPerRow;
-                       dst2 += picasso_vidinfo.rowbytes;
-                       y++;
-                   }
-               } else if (picasso_vidinfo.pixbytes == 4 && picasso96_state.BytesPerPixel == 1) { /* 8->32 */
-                   int x;
-                   while (y <= yend) {
-                       for (x = 0; x < picasso96_state.Width;) {
-                           ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                           ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                           ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                           ((uae_u32*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                       }
-                       src2 += picasso96_state.BytesPerRow;
-                       dst2 += picasso_vidinfo.rowbytes;
-                       y++;
-                   }
-               } else if (picasso_vidinfo.pixbytes == 2 && picasso96_state.BytesPerPixel == 4) { /* 32->16 */
-                   int x;
-                   while (y <= yend) {
-                       for (x = 0; x < picasso96_state.Width;) {
-                           uae_u32 v;
-                           v = ((uae_u32*)src2)[x];
-                           ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)];
-                           x++;
-                           v = ((uae_u32*)src2)[x];
-                           ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)];
-                           x++;
-                           v = ((uae_u32*)src2)[x];
-                           ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)];
-                           x++;
-                           v = ((uae_u32*)src2)[x];
-                           ((uae_u16*)dst2)[x] = p96_rgbx16[(((v >> (16 + 3)) & 0x1f) << 11) | (((v >> (8 + 2)) & 0x3f) << 5) | (((v >> (0 + 3)) & 0x1f) << 0)];
-                           x++;
-                       }
-                       src2 += picasso96_state.BytesPerRow;
-                       dst2 += picasso_vidinfo.rowbytes;
-                       y++;
-                   }
-               } else if (picasso_vidinfo.pixbytes == 2 && picasso96_state.BytesPerPixel == 1) { /* 8->16 */
-                   int x;
-                   while (y <= yend) {
-                       for (x = 0; x < picasso96_state.Width;) {
-                           ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                           ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                           ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                           ((uae_u16*)dst2)[x] = picasso_vidinfo.clut[src2[x]];
-                           x++;
-                       }
-                       src2 += picasso96_state.BytesPerRow;
-                       dst2 += picasso_vidinfo.rowbytes;
+               if (y < picasso96_state.Height) {
+                   int w = gwwpagesize / picasso96_state.BytesPerPixel;
+                   x = (realoffset % picasso96_state.BytesPerRow) / picasso96_state.BytesPerPixel;
+                   if (x < picasso96_state.Width)
+                       copyrow (src + off, dst, x, y, picasso96_state.Width - x);
+                   w = (gwwpagesize - (picasso96_state.BytesPerRow - x * picasso96_state.BytesPerPixel)) / picasso96_state.BytesPerPixel;
+                   if (y < miny)
+                       miny = y;
+                   y++;
+                   while (y < picasso96_state.Height && w > 0) {
+                       int maxw = w > picasso96_state.Width ? picasso96_state.Width : w;
+                       copyrow (src + off, dst, 0, y, maxw);
+                       w -= maxw;
                        y++;
                    }
+                   if (y > maxy)
+                       maxy = y;
                }
+
            }
 
        }
@@ -3385,7 +3729,7 @@ static void flushpixels (void)
        if (doskip () && p96skipmode == 4) {
            ;
        } else {
-           DX_Invalidate (0, miny, picasso96_state.Width, maxy - miny + 1);
+           DX_Invalidate (0, miny, picasso96_state.Width, maxy - miny);
        }
     }
 }
@@ -3628,6 +3972,28 @@ static void inituaegfxfuncs (uaecptr ABI)
     dl (0xfffffffe);
     dw (RTS);
 
+    /* CalculateBytesPerRow (optimized) */
+    put_long (ABI + PSSO_BoardInfo_CalculateBytesPerRow, here ());
+    dl (0x0c400140); // cmp.w #320,d0
+    dw (0x6504); // bcs.s .l1
+    calltrap (deftrap (picasso_CalculateBytesPerRow));
+    dw (RTS);
+    dw (0x0c87); dl (0x00000010); // l1: cmp.l #10,d7
+    dw (0x640a); // bcc.s .l2
+    dw (0x7200); // moveq #0,d1
+    dl (0x123b7010); // move.b table(pc,d7.w),d1
+    dw (0x6b04); // bmi.s l3
+    dw (0xe368); // lsl.w d1,d0
+    dw (RTS); // .l2
+    dw (0x3200); // .l3 move.w d0,d1
+    dw (0xd041);  // add.w d1,d0
+    dw (0xd041); // add.w d1,d0
+    dw (RTS);
+    dl (0x0000ffff); // table
+    dl (0x01010202);
+    dl (0x02020101);
+    dl (0x01010100);
+
     RTGNONE(ABI, PSSO_BoardInfo_SetClock);
     RTGNONE(ABI, PSSO_BoardInfo_SetMemoryMode);
     RTGNONE(ABI, PSSO_BoardInfo_SetWriteMask);
@@ -3657,7 +4023,6 @@ static void inituaegfxfuncs (uaecptr ABI)
     RTGCALL2(ABI, PSSO_BoardInfo_SetDAC, picasso_SetDAC);
     RTGCALL2(ABI, PSSO_BoardInfo_SetGC, picasso_SetGC);
     RTGCALL2(ABI, PSSO_BoardInfo_SetPanning, picasso_SetPanning);
-    RTGCALL2(ABI, PSSO_BoardInfo_CalculateBytesPerRow, picasso_CalculateBytesPerRow);
     RTGCALL2(ABI, PSSO_BoardInfo_SetDisplay, picasso_SetDisplay);
 
     RTGCALL2(ABI, PSSO_BoardInfo_SetSprite, picasso_SetSprite);
@@ -3738,10 +4103,10 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize)
     m68k_dreg (&ctx->regs, 1) = 0;
     uaegfx_base = CallLib (ctx, exec, -0x54); /* MakeLibrary */
     m68k_areg (&ctx->regs, 2) = a2;
-    if (uaegfx_base) {
-       m68k_areg (&ctx->regs, 1) = uaegfx_base;
-       CallLib (ctx, exec, -0x18c); /* AddLibrary */
-    }
+    if (!uaegfx_base)
+       return 0;
+    m68k_areg (&ctx->regs, 1) = uaegfx_base;
+    CallLib (ctx, exec, -0x18c); /* AddLibrary */
     m68k_areg (&ctx->regs, 1) = EXPANSION_explibname;
     m68k_dreg (&ctx->regs, 0) = 0;
     put_long (uaegfx_base + CARD_EXPANSIONBASE, CallLib (ctx, exec, -0x228)); /* OpenLibrary */
index db94f80039b4b8e2e2e47b68991859622c82c41a..441ca55502f1c8d44d22926b059c29e46d06c5e3 100755 (executable)
@@ -48,12 +48,12 @@ typedef enum {
  */
 typedef enum {
        PCT_Unknown,
-       PCT_S11483,                             // Sierra S11483: HiColor 15 bit, oMniBus, Domino
-       PCT_S15025,                             // Sierra S15025: TrueColor 32 bit, oMniBus
+       PCT_S11483,                     // Sierra S11483: HiColor 15 bit, oMniBus, Domino
+       PCT_S15025,                     // Sierra S15025: TrueColor 32 bit, oMniBus
        PCT_CirrusGD542x,               // Cirrus GD542x internal: TrueColor 24 bit
-       PCT_Domino,                             // is in fact a Sierra S11483
-       PCT_BT482,                              // BrookTree BT482: TrueColor 32 bit, Merlin
-       PCT_Music,                              // Music MU9C4910: TrueColor 24 bit, oMniBus
+       PCT_Domino,                     // is in fact a Sierra S11483
+       PCT_BT482,                      // BrookTree BT482: TrueColor 32 bit, Merlin
+       PCT_Music,                      // Music MU9C4910: TrueColor 24 bit, oMniBus
        PCT_ICS5300,                    // ICS 5300: ...., Retina BLT Z3
        PCT_CirrusGD5446,               // Cirrus GD5446 internal: TrueColor 24 bit
        PCT_CirrusGD5434,               // Cirrus GD5434 internal: TrueColor 32 bit
index fb60e3d5340a4455d0968d3cadf5145ce52d9dbf..da6adbee5ab2d958a5be24f4c6bba1c758e6b912 100755 (executable)
 #define IDC_DBG_MEM2                    1782
 #define IDC_DBG_MEMINPUT2               1783
 #define IDC_DBG_ADDRINPUTTXT            1784
+#define IDC_RTG_SCALE                   1785
+#define IDC_RTG_MATCH_DEPTH             1786
+#define IDC_RTG_8BIT                    1787
+#define IDC_RTG_16BIT                   1788
+#define IDC_RTG_24BIT                   1789
+#define IDC_RTG_32BIT                   1790
+#define IDC_DD_SURFACETYPE              1791
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NO_MFC                     1
 #define _APS_3D_CONTROLS                     1
-#define _APS_NEXT_RESOURCE_VALUE        335
+#define _APS_NEXT_RESOURCE_VALUE        336
 #define _APS_NEXT_COMMAND_VALUE         40045
-#define _APS_NEXT_CONTROL_VALUE         1785
+#define _APS_NEXT_CONTROL_VALUE         1788
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 2251cfb847bdf1e1103cbe5cf0c18be560f3c3bf..da6adbee5ab2d958a5be24f4c6bba1c758e6b912 100755 (executable)
 #define IDC_DBG_MEM2                    1782
 #define IDC_DBG_MEMINPUT2               1783
 #define IDC_DBG_ADDRINPUTTXT            1784
+#define IDC_RTG_SCALE                   1785
+#define IDC_RTG_MATCH_DEPTH             1786
+#define IDC_RTG_8BIT                    1787
+#define IDC_RTG_16BIT                   1788
+#define IDC_RTG_24BIT                   1789
+#define IDC_RTG_32BIT                   1790
+#define IDC_DD_SURFACETYPE              1791
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
 #define _APS_3D_CONTROLS                     1
 #define _APS_NEXT_RESOURCE_VALUE        336
 #define _APS_NEXT_COMMAND_VALUE         40045
-#define _APS_NEXT_CONTROL_VALUE         1785
+#define _APS_NEXT_CONTROL_VALUE         1788
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index d28b89481e5239ee60b2388b66cbacd957838e2e..79af791bb40f2153eb28d27642a337c7d9590f20 100755 (executable)
@@ -118,12 +118,12 @@ BEGIN
     COMBOBOX        IDC_LORES,100,140,102,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
 END\r
 \r
-IDD_MEMORY DIALOGEX 0, 0, 300, 175\r
+IDD_MEMORY DIALOGEX 0, 0, 300, 239\r
 STYLE DS_LOCALEDIT | DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD\r
 EXSTYLE WS_EX_CONTEXTHELP\r
 FONT 8, "MS Sans Serif", 0, 0, 0x1\r
 BEGIN\r
-    GROUPBOX        "Memory Settings",-1,14,7,274,91\r
+    GROUPBOX        "Memory Settings",-1,14,7,274,69\r
     RTEXT           "Chip:",-1,24,26,20,10,SS_CENTERIMAGE\r
     CONTROL         "Slider1",IDC_CHIPMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,54,22,50,20\r
     EDITTEXT        IDC_CHIPRAM,105,25,30,12,ES_CENTER | ES_READONLY\r
@@ -136,16 +136,25 @@ BEGIN
     RTEXT           "Z3 Fast:",IDC_Z3TEXT,139,51,30,10,SS_CENTERIMAGE\r
     CONTROL         "Slider1",IDC_Z3FASTMEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,47,60,20\r
     EDITTEXT        IDC_Z3FASTRAM,243,50,30,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "RTG: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,136,76,33,10,SS_NOTIFY | SS_CENTERIMAGE\r
-    CONTROL         "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,179,72,60,20\r
-    EDITTEXT        IDC_P96RAM,243,75,30,12,ES_CENTER | ES_READONLY\r
-    GROUPBOX        "Advanced Memory Settings",-1,13,104,275,65\r
-    RTEXT           "Motherboard RAM (Low area):",-1,39,123,129,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,119,59,20\r
-    EDITTEXT        IDC_MBRAM1,243,122,30,12,ES_CENTER | ES_READONLY\r
-    RTEXT           "Motherboard RAM (High area):",-1,39,148,129,10,SS_CENTERIMAGE\r
-    CONTROL         "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,144,59,20\r
-    EDITTEXT        IDC_MBRAM2,243,147,30,12,ES_CENTER | ES_READONLY\r
+    RTEXT           "Memory: [] Graphics card memory. Required for RTG (Picasso96) emulation.",IDC_GFXCARDTEXT,25,98,53,10,SS_NOTIFY | SS_CENTERIMAGE\r
+    CONTROL         "Slider1",IDC_P96MEM,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,88,94,60,20\r
+    EDITTEXT        IDC_P96RAM,152,97,30,12,ES_CENTER | ES_READONLY\r
+    GROUPBOX        "Advanced Memory Settings",-1,13,171,275,65\r
+    RTEXT           "Motherboard RAM (Low area):",-1,39,190,129,10,SS_CENTERIMAGE\r
+    CONTROL         "",IDC_MBMEM1,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,186,59,20\r
+    EDITTEXT        IDC_MBRAM1,243,189,30,12,ES_CENTER | ES_READONLY\r
+    RTEXT           "Motherboard RAM (High area):",-1,39,215,129,10,SS_CENTERIMAGE\r
+    CONTROL         "",IDC_MBMEM2,"msctls_trackbar32",TBS_AUTOTICKS | TBS_TOP | WS_TABSTOP,180,211,59,20\r
+    EDITTEXT        IDC_MBRAM2,243,214,30,12,ES_CENTER | ES_READONLY\r
+    GROUPBOX        "RTG Graphics Card Settings",-1,14,81,275,87\r
+    CONTROL         "Scale instead of switching resolution",IDC_RTG_SCALE,\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,134,162,10\r
+    CONTROL         "Match host and RTG color depth if possible",IDC_RTG_MATCH_DEPTH,\r
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,119,163,10\r
+    COMBOBOX        IDC_RTG_8BIT,211,101,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    COMBOBOX        IDC_RTG_16BIT,211,117,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    COMBOBOX        IDC_RTG_24BIT,211,133,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    COMBOBOX        IDC_RTG_32BIT,211,149,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
 END\r
 \r
 IDD_CPU DIALOGEX 0, 0, 300, 226\r
@@ -401,9 +410,7 @@ BEGIN
     CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,66,117,10\r
     CONTROL         "bsdsocket.library emulation",IDC_SOCKETS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,15,120,10\r
     CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,27,120,10\r
-    CONTROL         "RTG color depth matching [] Do not use color space conversion if possible.",IDC_RTGMATCHDEPTH,\r
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,40,120,10\r
-    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,53,115,10\r
+    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,40,115,10\r
     GROUPBOX        "Keyboard LEDs",IDC_STATIC,7,140,85,94\r
     COMBOBOX        IDC_KBLED1,22,154,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_KBLED2,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
@@ -420,14 +427,16 @@ BEGIN
     RTEXT           "Recording buffer (MB):",IDC_STATIC,160,219,83,10,SS_CENTERIMAGE | WS_TABSTOP\r
     COMBOBOX        IDC_STATE_BUFFERSIZE,248,217,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
     CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,79,117,10\r
-    CONTROL         "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,66,115,10\r
+    CONTROL         "Catweasel",IDC_CATWEASEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,53,115,10\r
     CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10\r
     COMBOBOX        IDC_SCSIMODE,92,51,64,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_LANGUAGE,103,121,179,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     GROUPBOX        "Language",IDC_STATIC,7,113,285,25\r
     CONTROL         "Disable powersaving features",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,92,120,10\r
-    CONTROL         "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,79,119,10\r
-    CONTROL         "uaenet.device",IDC_SANA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,92,94,10\r
+    CONTROL         "Magic Mouse",IDC_MOUSETRICK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,66,119,10\r
+    CONTROL         "uaenet.device",IDC_SANA2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,79,94,10\r
+    COMBOBOX        IDC_DD_SURFACETYPE,217,93,68,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    RTEXT           "Display buffer:",IDC_STATIC,159,94,52,10,SS_CENTERIMAGE\r
 END\r
 \r
 IDD_HARDFILE DIALOGEX 0, 0, 299, 249\r
index 45bf9bea6b5ff4c52caa10d494492bc740f7a081..130760bd84d98e24cadb5005b018b091606ae72d 100755 (executable)
@@ -40,9 +40,20 @@ static int default_width, default_height;
 static int hwndset;
 static int minimized;
 static DWORD hd_mask, cd_mask;
+static int mousecapture, mousemagic;
 
 static int recursive_device;
 
+static void outhex (const uae_u8 *s)
+{
+    for (;;) {
+       write_log ("%02X%02X ", s[0], s[1]);
+       if (s[0] == 0 && s[1] == 0)
+           break;
+       s += 2;
+    }
+    write_log ("\n");
+}
 
 static char *ua (const WCHAR *s)
 {
@@ -109,6 +120,7 @@ static const char *getmsg (int msg)
        case RPIPCHM_MOUSECAPTURE: return "RPIPCHM_MOUSECAPTURE";
        case RPIPCHM_DEVICECONTENT: return "RPIPCHM_DEVICECONTENT";
        case RPIPCHM_PING: return "RPIPCHM_PING";
+       case RPIPCHM_SCREENCLIP: return "RPIPCHM_SCREENCLIP";
 
        default: return "UNKNOWN";
     }
@@ -117,7 +129,7 @@ static const char *getmsg (int msg)
 static int port_insert (int num, const char *name)
 {
     char tmp1[100], tmp2[200];
-    int i;
+    int i, type;
 
     if (num < 0 || num > 1)
        return FALSE;
@@ -127,23 +139,33 @@ static int port_insert (int num, const char *name)
     }
     if (strlen (name) >= sizeof (tmp2) - 1)
        return FALSE;
+    type = 1;
     strcpy (tmp2, name);
     for (i = 1; i <= 4; i++) {
        sprintf (tmp1, "Mouse%d", i);
-       if (!strcmp (name, tmp1))
+       if (!strcmp (name, tmp1)) {
            sprintf (tmp2, "mouse%d", i - 1);
+           type = 0;
+           break;
+       }
        sprintf (tmp1, "Joystick%d", i);
-       if (!strcmp (name, tmp1))
+       if (!strcmp (name, tmp1)) {
            sprintf (tmp2, "joy%d", i - 1);
+           type = 0;
+           break;
+       }
        sprintf (tmp1, "KeyboardLayout%d", i);
-       if (!strcmp (name, tmp1))
+       if (!strcmp (name, tmp1)) {
            sprintf (tmp2, "kbd%d", i);
+           type = 0;
+           break;
+       }
     }
-    inputdevice_joyport_config (&changed_prefs, tmp2, num, 1);
+    inputdevice_joyport_config (&changed_prefs, tmp2, num, type);
     return TRUE;
 }
 
-BOOL RPSendMessagex(UINT uMessage, WPARAM wParam, LPARAM lParam,
+static BOOL RPSendMessagex (UINT uMessage, WPARAM wParam, LPARAM lParam,
                    LPCVOID pData, DWORD dwDataSize, const RPGUESTINFO *pInfo, LRESULT *plResult)
 {
     BOOL v;
@@ -179,13 +201,17 @@ static int get_x (void)
 {
     int res = currprefs.gfx_resolution;
 
-    if (currprefs.gfx_afullscreen)
-       return RP_SCREENMODE_FULLSCREEN;
-    if (res == 0)
-       return RP_SCREENMODE_1X;
-    if (res == 1)
-       return RP_SCREENMODE_2X;
-    return RP_SCREENMODE_4X;
+    if (WIN32GFX_IsPicassoScreen ()) {
+       return currprefs.gfx_pfullscreen ? RP_SCREENMODE_FULLSCREEN : RP_SCREENMODE_1X;
+    } else {
+       if (currprefs.gfx_afullscreen)
+           return RP_SCREENMODE_FULLSCREEN;
+       if (res == 0)
+           return RP_SCREENMODE_1X;
+       if (res == 1)
+           return RP_SCREENMODE_2X;
+       return RP_SCREENMODE_4X;
+    }
 }
 
 static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM lParam,
@@ -209,13 +235,18 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
            uae_reset (wParam == RP_RESET_SOFT ? 0 : -1);
        return TRUE;
        case RPIPCHM_TURBO:
-           warpmode (lParam);
+       {
+           if (wParam & RP_TURBO_CPU)
+               warpmode ((lParam & RP_TURBO_CPU) ? 1 : 0);
+           if (wParam & RP_TURBO_FLOPPY)
+               changed_prefs.floppy_speed = (lParam & RP_TURBO_FLOPPY) ? 0 : 100;
+       }
        return TRUE;
        case RPIPCHM_PAUSE:
            pausemode (wParam ? 1 : 0);
        return TRUE;
        case RPIPCHM_VOLUME:
-           currprefs.sound_volume = changed_prefs.sound_volume = wParam;
+           currprefs.sound_volume = changed_prefs.sound_volume = 100 - wParam;
            set_volume (currprefs.sound_volume, 0);
        return TRUE;
        case RPIPCHM_ESCAPEKEY:
@@ -223,10 +254,12 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
            rp_rpescapeholdtime = lParam;
         return TRUE;
        case RPIPCHM_MOUSECAPTURE:
-           if (wParam)
-               setmouseactive (1);
+       {
+           if (wParam & RP_MOUSECAPTURE_CAPTURED)
+               setmouseactive (1);
            else
                setmouseactive (0);
+       }
        return TRUE;
 #if 0
        case RPIPCHM_MINIMIZE:
@@ -269,21 +302,25 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
        {
            int res = (BYTE)wParam;
            minimized = 0;
-           changed_prefs.gfx_afullscreen = 0;
-           if (res >= RP_SCREENMODE_FULLSCREEN) {
-               res = 1;
-               changed_prefs.gfx_afullscreen = 1;
+           if (WIN32GFX_IsPicassoScreen ()) {
+               changed_prefs.gfx_pfullscreen = res >= RP_SCREENMODE_FULLSCREEN ? 1 : 0;
+           } else {
+               changed_prefs.gfx_afullscreen = 0;
+               if (res >= RP_SCREENMODE_FULLSCREEN) {
+                   res = 1;
+                   changed_prefs.gfx_afullscreen = 1;
+               }
+               changed_prefs.gfx_resolution = res;
+               if (res == 0)
+                   changed_prefs.gfx_linedbl = 0;
+               else
+                   changed_prefs.gfx_linedbl = 1;
+               res = 1 << res;
+               changed_prefs.gfx_size_win.width = default_width * res;
+               changed_prefs.gfx_size_win.height = default_height * res;
            }
-           changed_prefs.gfx_resolution = res;
-           if (res == 0)
-               changed_prefs.gfx_linedbl = 0;
-           else
-               changed_prefs.gfx_linedbl = 1;
-           res = 1 << res;
-           changed_prefs.gfx_size_win.width = default_width * res;
-           changed_prefs.gfx_size_win.height = default_height * res;
            updatewinfsmode (&changed_prefs);
-           WIN32GFX_DisplayChangeRequested();
+           WIN32GFX_DisplayChangeRequested ();
            hwndset = 0;
            return (LRESULT)INVALID_HANDLE_VALUE;
        }
@@ -315,7 +352,30 @@ static LRESULT CALLBACK RPHostMsgFunction2 (UINT uMessage, WPARAM wParam, LPARAM
            xfree (s);
            return ok ? TRUE : FALSE;
        }
-
+       case RPIPCHM_SCREENCLIP:
+       {
+           RPSCREENCLIP *sc = (RPSCREENCLIP*)pData;
+
+           if (sc->lLeft < 0 || sc->lTop < 0) {
+               changed_prefs.gfx_xcenter_pos = -1;
+               changed_prefs.gfx_ycenter_pos = -1;
+           } else {
+               changed_prefs.gfx_xcenter_pos = sc->lLeft;
+               changed_prefs.gfx_ycenter_pos = sc->lTop;
+           }
+           if (sc->lWidth <= 0) {
+               changed_prefs.gfx_size_win.width = default_width;
+           } else {
+               changed_prefs.gfx_size_win.width = sc->lWidth << (RES_MAX - currprefs.gfx_resolution);
+           }
+           if (sc->lHeight <= 0) {
+               changed_prefs.gfx_size_win.height = default_height;
+           } else {
+               changed_prefs.gfx_size_win.height = sc->lHeight << (currprefs.gfx_linedbl ? 0 : 1);
+           }
+           fixup_prefs_dimensions (&changed_prefs);
+       }
+       return TRUE;
     }
     return FALSE;
 }
@@ -343,6 +403,7 @@ HRESULT rp_init (void)
     }
     xfree (rp_param);
     rp_param = NULL;
+    mousecapture = 0;
     return hr;
 }
 
@@ -351,7 +412,7 @@ void rp_free (void)
     if (!initialized)
        return;
     initialized = 0;
-    RPSendMessagex(RPIPCGM_CLOSED, 0, 0, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_CLOSED, 0, 0, NULL, 0, &guestinfo, NULL);
     RPUninitializeGuest (&guestinfo);
 }
 
@@ -360,13 +421,23 @@ HWND rp_getparent (void)
     LRESULT lr;
     if (!initialized)
        return 0;
-    RPSendMessagex(RPIPCGM_PARENT, 0, 0, NULL, 0, &guestinfo, &lr);
+    RPSendMessagex (RPIPCGM_PARENT, 0, 0, NULL, 0, &guestinfo, &lr);
     return (HWND)lr;
 }
 
-void rp_fixup_options (struct uae_prefs *p)
+static void sendfeatures (void)
 {
     DWORD feat;
+
+    feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN;
+    feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE;
+    if (!WIN32GFX_IsPicassoScreen ())
+       feat |= RP_FEATURE_SCREEN2X;
+    RPSendMessagex (RPIPCGM_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL);
+}
+
+void rp_fixup_options (struct uae_prefs *p)
+{
     int i, v;
     int res;
     int p96;
@@ -401,11 +472,7 @@ void rp_fixup_options (struct uae_prefs *p)
     else
        p->gfx_linedbl = 1;
 
-    feat = RP_FEATURE_POWERLED | RP_FEATURE_SCREEN1X | RP_FEATURE_FULLSCREEN;
-    feat |= RP_FEATURE_PAUSE | RP_FEATURE_TURBO | RP_FEATURE_VOLUME | RP_FEATURE_SCREENCAPTURE;
-    if (!p96)
-       feat |= RP_FEATURE_SCREEN2X;
-    RPSendMessagex(RPIPCGM_FEATURES, feat, 0, NULL, 0, &guestinfo, NULL);
+    sendfeatures ();
 
     /* floppy drives */
     v = 0;
@@ -413,9 +480,9 @@ void rp_fixup_options (struct uae_prefs *p)
        if (p->dfxtype[i] >= 0)
            v |= 1 << i;
     }
-    RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_FLOPPY, v, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_FLOPPY, v, NULL, 0, &guestinfo, NULL);
 
-    RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_INPUTPORT, 3, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_INPUTPORT, 3, NULL, 0, &guestinfo, NULL);
 
     cd_mask = 0;
     for (i = 0; i < currprefs.mountitems; i++) {
@@ -428,7 +495,7 @@ void rp_fixup_options (struct uae_prefs *p)
            hd_mask |= 1 << (uci->controller -  HD_CONTROLLER_SCSI0);
        }
     }
-    RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_HD, hd_mask, NULL, 0, &guestinfo, NULL);
 }
 
 static void rp_device_change (int dev, int num, const char *name)
@@ -477,7 +544,7 @@ void rp_cd_change (int num, int removed)
        cd_mask &= ~(1 << num);
     else
        cd_mask |= 1 << num;
-    RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL);
 }
 
 void rp_update_leds (int led, int onoff)
@@ -489,13 +556,13 @@ void rp_update_leds (int led, int onoff)
     switch (led)
     {
        case 0:
-        RPSendMessage(RPIPCGM_POWERLED, onoff ? 100 : 0, 0, NULL, 0, &guestinfo, NULL);
+        RPSendMessage (RPIPCGM_POWERLED, onoff ? 100 : 0, 0, NULL, 0, &guestinfo, NULL);
        break;
        case 1:
        case 2:
        case 3:
        case 4:
-        RPSendMessage(RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_FLOPPY, led - 1), onoff ? -1 : 0, NULL, 0, &guestinfo, NULL);
+        RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_FLOPPY, led - 1), onoff ? -1 : 0, NULL, 0, &guestinfo, NULL);
        break;
     }
 }
@@ -507,7 +574,7 @@ void rp_hd_activity (int num, int onoff)
     if (num < 0)
        return;
     if (onoff)
-       RPSendMessage(RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_HD, num), 200, NULL, 0, &guestinfo, NULL);
+       RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_HD, num), 200, NULL, 0, &guestinfo, NULL);
 }
 
 void rp_cd_activity (int num, int onoff)
@@ -518,33 +585,50 @@ void rp_cd_activity (int num, int onoff)
        return;
     if ((cd_mask & (1 << num)) != ((onoff ? 1 : 0) << num)) {
         cd_mask ^= 1 << num;
-        RPSendMessagex(RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL);
+        RPSendMessagex (RPIPCGM_DEVICES, RP_DEVICE_CD, cd_mask, NULL, 0, &guestinfo, NULL);
     }
     if (onoff) {
-       RPSendMessage(RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_CD, num), 200, NULL, 0, &guestinfo, NULL);
+       RPSendMessage (RPIPCGM_DEVICEACTIVITY, MAKEWORD (RP_DEVICE_CD, num), 200, NULL, 0, &guestinfo, NULL);
     }
 }
 
-
 void rp_update_status (struct uae_prefs *p)
 {
     if (!initialized)
        return;
-    RPSendMessagex(RPIPCGM_VOLUME, (WPARAM)p->sound_volume, 0, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_VOLUME, (WPARAM)(100 - p->sound_volume), 0, NULL, 0, &guestinfo, NULL);
 }
 
-void rp_mousecapture (int captured)
+static void rp_mouse (void)
 {
-    if (!winok())
+    int flags = 0;
+
+    if (!initialized)
        return;
-    RPSendMessagex(RPIPCGM_MOUSECAPTURE, captured, 0, NULL, 0, &guestinfo, NULL);
+    if (mousemagic)
+       flags |= RP_MOUSECAPTURE_MAGICMOUSE;
+    if (mousecapture)
+       flags |= RP_MOUSECAPTURE_CAPTURED;
+    RPSendMessagex (RPIPCGM_MOUSECAPTURE, flags, 0, NULL, 0, &guestinfo, NULL);
+}
+
+void rp_mouse_capture (int captured)
+{
+    mousecapture = captured;
+    rp_mouse ();
+}
+
+void rp_mouse_magic (int magic)
+{
+    mousemagic = magic;
+    rp_mouse ();
 }
 
 void rp_activate (int active, LPARAM lParam)
 {
     if (!initialized)
        return;
-    RPSendMessagex(active ? RPIPCGM_ACTIVATED : RPIPCGM_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (active ? RPIPCGM_ACTIVATED : RPIPCGM_DEACTIVATED, 0, lParam, NULL, 0, &guestinfo, NULL);
 }
 
 #if 0
@@ -560,7 +644,7 @@ void rp_turbo (int active)
 {
     if (!initialized)
        return;
-    RPSendMessagex(RPIPCGM_TURBO, RP_TURBO_CPU, active, NULL, 0, &guestinfo, NULL);
+    RPSendMessagex (RPIPCGM_TURBO, RP_TURBO_CPU, active, NULL, 0, &guestinfo, NULL);
 }
 
 void rp_set_hwnd (HWND hWnd)
@@ -570,17 +654,15 @@ void rp_set_hwnd (HWND hWnd)
        return;
     rx = get_x ();
     hwndset = 1;
-    RPSendMessagex(RPIPCGM_SCREENMODE, rx, (LPARAM)hWnd, NULL, 0, &guestinfo, NULL); 
+    RPSendMessagex (RPIPCGM_SCREENMODE, rx, (LPARAM)hWnd, NULL, 0, &guestinfo, NULL); 
 }
 
-#if 0
-void rp_moved (int zorder)
+void rp_rtg_switch (void)
 {
-    if (!winok())
+    if (!initialized)
        return;
-    RPSendMessagex(zorder ? RPIPCGM_ZORDER : RPIPCGM_MOVED, 0, 0, NULL, 0, &guestinfo, NULL);
+    sendfeatures ();
 }
-#endif
 
 static uae_u64 esctime;
 static int ignorerelease;
@@ -599,22 +681,19 @@ static uae_u64 gett (void)
     return li.QuadPart / 10000;
 }
 
-void rp_hsync (void)
+void rp_vsync (void)
 {
     uae_u64 t;
-    static int cnt;
 
     if (!initialized)
        return;
-    cnt--;
-    if (cnt > 0)
-       return;
-    cnt = 100;
+    if (magicmouse_alive () != mousemagic)
+       rp_mouse_magic (magicmouse_alive ());
     if (!esctime)
        return;
     t = gett ();
     if (t >= esctime) {
-       RPSendMessagex(RPIPCGM_ESCAPED, 0, 0, NULL, 0, &guestinfo, NULL);
+       RPSendMessagex (RPIPCGM_ESCAPED, 0, 0, NULL, 0, &guestinfo, NULL);
        ignorerelease = 1;
        esctime = 0;
     }
index 42550abc7839c4c6fc6a6211e492f532ee64619a..9f846c3e080f888dab5d475616445c82f78296ec 100755 (executable)
@@ -9,13 +9,15 @@ extern void rp_hd_change (int, int);
 extern void rp_cd_activity (int, int);
 extern void rp_cd_change (int, int);
 extern void rp_activate (int, LPARAM);
-extern void rp_mousecapture (int);
+extern void rp_mouse_capture (int);
+extern void rp_mouse_magic (int);
 extern void rp_turbo (int);
 extern void rp_set_hwnd (HWND);
 extern int rp_checkesc (int, uae_u8*, int, int);
 extern int rp_isactive (void);
-extern void rp_hsync (void);
+extern void rp_vsync (void);
 extern HWND rp_getparent (void);
+extern void rp_rtg_switch (void);
 
 extern char *rp_param;
 extern int rp_rpescapekey;
index 5fe20d47c335961901ecc07bf4b2d7d4fee7e529..8c497a9c52f4f6654dc1b480fea0fa7084121cb4 100755 (executable)
@@ -236,7 +236,7 @@ int screenshotf (const char *spath, int mode, int doprepare)
     recursive++;
 
     if (!screenshot_prepared || doprepare) {
-       if (!screenshot_prepare())
+       if (!screenshot_prepare ())
            goto oops;
     }
 
index 2dfabc7fe2df152838bb230d95ce58f77a6b6aa1..fee4ced1607dcb910678253927eea78c70a410db 100755 (executable)
@@ -21,9 +21,11 @@ typedef USHORT ushort;
 struct shmid_ds {
     key_t  key;
     size_t size;
-    void  *addr;
+    void   *addr;
     char   name[MAX_PATH];
     void   *attached;
+    int    mode;
+    void   *natmembase;
 };
 
 int mprotect (void *addr, size_t len, int prot);
index db5ef3f3b5ba4d81e19bbdd5743952c84d9a5421..6b076c060449b20e6a6d907e9c155e6d92b7d10d 100755 (executable)
@@ -47,6 +47,7 @@
 #define CPUEMU_12 /* cycle-exact cpu&blitter */
 #define ACTION_REPLAY /* Action Replay 1/2/3 support */
 #define PICASSO96 /* Picasso96 display card emulation */
+#define UAEGFX_INTERNAL /* built-in libs:picasso96/uaegfx.card */
 #define BSDSOCKET /* bsdsocket.library emulation */
 #define CAPS /* CAPS-image support */
 #define FDI2RAW /* FDI 1.0 and 2.x image support */
index b737f2391ed532d957ee45fc931f80a4d4e3f825..64430b10a665381b8a16bc7f8017f6e85eb7085b 100755 (executable)
@@ -387,7 +387,8 @@ void setmouseactive (int active)
        checkpause ();
     setmaintitle (hMainWnd);
 #ifdef RETROPLATFORM
-    rp_mousecapture (active);
+    rp_mouse_capture (active);
+    rp_mouse_magic (magicmouse_alive ());
 #endif
 }
 
@@ -1148,6 +1149,9 @@ void handle_events (void)
        inputdevicefunc_joystick.read ();
        inputdevice_handle_inputcode ();
        check_prefs_changed_gfx ();
+#ifdef RETROPLATFORM
+       rp_vsync ();
+#endif
        while (checkIPC (&currprefs));
        if (quit_program)
            break;
@@ -1635,7 +1639,7 @@ uae_u8 *target_load_keyfile (struct uae_prefs *p, char *path, int *sizep, char *
 
 extern char *get_aspi_path(int);
 
-static get_aspi(int old)
+static get_aspi (int old)
 {
     if ((old == UAESCSI_SPTI || old == UAESCSI_SPTISCAN) && os_winnt_admin)
        return old;
@@ -1693,7 +1697,7 @@ void target_default_options (struct uae_prefs *p, int type)
        p->win32_automount_cddrives = 0;
        p->win32_automount_netdrives = 0;
        p->win32_kbledmode = 0;
-       p->win32_uaescsimode = get_aspi(p->win32_uaescsimode);
+       p->win32_uaescsimode = get_aspi (p->win32_uaescsimode);
        p->win32_borderless = 0;
        p->win32_powersavedisabled = 1;
        p->win32_outsidemouse = 0;
@@ -1702,13 +1706,14 @@ void target_default_options (struct uae_prefs *p, int type)
        p->win32_rtgscaleifsmall = 1;
     }
     if (type == 1 || type == 0) {
-       p->win32_uaescsimode = get_aspi(p->win32_uaescsimode);
+       p->win32_uaescsimode = get_aspi (p->win32_uaescsimode);
        p->win32_midioutdev = -2;
        p->win32_midiindev = 0;
        p->win32_automount_removable = 0;
        p->win32_automount_drives = 0;
        p->win32_automount_cddrives = 0;
        p->win32_automount_netdrives = 0;
+       p->picasso96_modeflags = RGBFF_CLUT | RGBFF_R5G6B5PC | RGBFF_B8G8R8A8;
     }
 }
 
@@ -1863,12 +1868,17 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
     return result;
 }
 
+static void createdir (const char *path)
+{
+    CreateDirectory (path, NULL);
+}
+
 void fetch_saveimagepath (char *out, int size, int dir)
 {
     fetch_path ("SaveimagePath", out, size);
     if (dir) {
        out[strlen (out) - 1] = 0;
-       CreateDirectory (out, NULL);
+       createdir (out);
        fetch_path ("SaveimagePath", out, size);
     }
 }
@@ -2264,22 +2274,23 @@ static void WIN32_HandleRegistryStuff(void)
         if (regsetstr (NULL, "ROMCheckVersion", VersionStr))
        forceroms = 1;
     }
+    regqueryint (NULL, "directdraw_secondary", &ddforceram);
     regqueryint (NULL, "QuickStartMode", &quickstart);
     reopen_console();
     fetch_path ("ConfigurationPath", path, sizeof (path));
     path[strlen (path) - 1] = 0;
-    CreateDirectory (path, NULL);
+    createdir (path);
     strcat (path, "\\Host");
-    CreateDirectory (path, NULL);
+    createdir (path);
     fetch_path ("ConfigurationPath", path, sizeof (path));
     strcat (path, "Hardware");
-    CreateDirectory (path, NULL);
+    createdir (path);
     fetch_path ("StatefilePath", path, sizeof (path));
-    CreateDirectory (path, NULL);
+    createdir (path);
     strcat (path, "default.uss");
     strcpy (savestate_fname, path);
     fetch_path ("InputPath", path, sizeof (path));
-    CreateDirectory (path, NULL);
+    createdir (path);
     regclosetree (read_disk_history ());
     read_rom_list ();
     load_keyring(NULL, NULL);
@@ -2514,12 +2525,12 @@ void create_afnewdir(int remove)
        strcat(tmp, "\\WinUAE");
        if (remove) {
            if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES) {
-               RemoveDirectory(tmp);
-               RemoveDirectory(tmp2);
+               RemoveDirectory (tmp);
+               RemoveDirectory (tmp2);
            }
        } else {
-           CreateDirectory(tmp2, NULL);
-           CreateDirectory(tmp, NULL);
+           CreateDirectory (tmp2, NULL);
+           CreateDirectory (tmp, NULL);
        }
     }
 }
index ea2edf09cc504293702c98b62a7fa891a86d94e5..29fe48880ab419517fbfebeaf8e3bfd909bc7259 100755 (executable)
@@ -15,9 +15,9 @@
 #define GETBDM(x) (((x) - ((x / 10000) * 10000)) / 100)
 #define GETBDD(x) ((x) % 100)
 
-#define WINUAEBETA 10
+#define WINUAEBETA 11
 #define WINUAEPUBLICBETA 1
-#define WINUAEDATE MAKEBD(2008, 3, 23)
+#define WINUAEDATE MAKEBD(2008, 3, 30)
 #define WINUAEEXTRA ""
 #define WINUAEREV ""
 
index 4dd4949b4885e529442ecc978c45899270d041d4..d1a621efbfd595123937118f4c1e45e5468296a2 100755 (executable)
@@ -165,11 +165,33 @@ static BOOL doInit (void);
 uae_u32 default_freq = 0;
 
 HWND hStatusWnd = NULL;
-uae_u16 picasso96_pixel_format = RGBFF_CHUNKY;
 
 static uae_u8 scrlinebuf[4096 * 4]; /* this is too large, but let's rather play on the safe side here */
 
 
+static struct MultiDisplay *getdisplay (struct uae_prefs *p)
+{
+    int i;
+    int display = p->gfx_display;
+
+    i = 0;
+    while (Displays[i].name) {
+       struct MultiDisplay *md = &Displays[i];
+       if (p->gfx_display_name[0] && !strcmp (md->name, p->gfx_display_name))
+           return md;
+       if (p->gfx_display_name[0] && !strcmp (md->name2, p->gfx_display_name))
+           return md;
+       i++;
+    }
+    if (i == 0) {
+       gui_message ("no display adapters! Exiting");
+       exit (0);
+    }
+    if (display >= i)
+       display = 0;
+    return &Displays[display];
+}
+
 void centerdstrect (RECT *dr)
 {
     if(!(currentmode->flags & (DM_DX_FULLSCREEN | DM_W_FULLSCREEN)))
@@ -271,10 +293,10 @@ static HRESULT CALLBACK modesCallback (LPDDSURFACEDESC2 modeDesc, LPVOID context
     RGBFTYPE colortype;
     int i, j, ct, depth;
 
-    colortype = DirectDraw_GetSurfacePixelFormat(modeDesc);
-    if (colortype == RGBFB_NONE || colortype == RGBFB_R8G8B8 || colortype == RGBFB_B8G8R8 )
+    colortype = DirectDraw_GetSurfacePixelFormat (modeDesc);
+    if (colortype == RGBFB_NONE)
        return DDENUMRET_OK;
-    if (modeDesc->dwWidth > 2048 || modeDesc->dwHeight > 2048)
+    if (modeDesc->dwWidth > 2560 || modeDesc->dwHeight > 2048)
        return DDENUMRET_OK;
     ct = 1 << colortype;
     depth = 0;
@@ -303,7 +325,6 @@ static HRESULT CALLBACK modesCallback (LPDDSURFACEDESC2 modeDesc, LPVOID context
        }
        i++;
     }
-    picasso96_pixel_format |= ct;
     i = 0;
     while (DisplayModes[i].depth >= 0)
        i++;
@@ -386,10 +407,10 @@ BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx,
     if (guid == 0) {
        POINT pt = { 0, 0 };
        md->primary = 1;
-       GetMonitorInfo(MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY), (LPMONITORINFO)&lpmi);
+       GetMonitorInfo (MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY), (LPMONITORINFO)&lpmi);
     } else {
        memcpy (&md->guid,  guid, sizeof (GUID));
-       GetMonitorInfo(hm, (LPMONITORINFO)&lpmi);
+       GetMonitorInfo (hm, (LPMONITORINFO)&lpmi);
     }
     md->rect = lpmi.rcMonitor;
     if (md->rect.left == 0 && md->rect.top == 0)
@@ -397,6 +418,7 @@ BOOL CALLBACK displaysCallback (GUID *guid, LPSTR desc, LPSTR name, LPVOID ctx,
     else
         sprintf (tmp, "%s (%d*%d) [%d*%d]", desc, md->rect.right - md->rect.left, md->rect.bottom - md->rect.top, md->rect.left, md->rect.top);
     md->name = my_strdup (tmp);
+    md->name2 = my_strdup (desc);
     write_log ("'%s' '%s' %s\n", desc, name, outGUID(guid));
     return 1;
 }
@@ -783,7 +805,8 @@ static int open_windows (void)
     } while (ret < 0);
 
     setpriority(&priorities[currprefs.win32_active_priority]);
-    setmouseactive (-1);
+    if (!rp_isactive ())
+       setmouseactive (-1);
     for (i = 0; i < NUM_LEDS; i++)
        gui_led (i, 0);
     gui_fps (0, 0);
@@ -831,9 +854,11 @@ int check_prefs_changed_gfx (void)
     c |= currprefs.gfx_linedbl != changed_prefs.gfx_linedbl ? 2 : 0;
     c |= currprefs.gfx_lores_mode != changed_prefs.gfx_lores_mode ? 1 : 0;
     c |= currprefs.gfx_display != changed_prefs.gfx_display ? (2|4|8) : 0;
+    c |= strcmp (currprefs.gfx_display_name, changed_prefs.gfx_display_name) ? (2|4|8) : 0;
     c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 1 : 0;
     c |= currprefs.win32_borderless != changed_prefs.win32_borderless ? 1 : 0;
     c |= currprefs.win32_rtgmatchdepth != changed_prefs.win32_rtgmatchdepth ? 2 : 0;
+    c |= currprefs.win32_rtgscaleifsmall != changed_prefs.win32_rtgscaleifsmall ? 2 : 0;
 
     if (display_change_requested || c)
     {
@@ -865,9 +890,11 @@ int check_prefs_changed_gfx (void)
        currprefs.gfx_resolution = changed_prefs.gfx_resolution;
        currprefs.gfx_linedbl = changed_prefs.gfx_linedbl;
        currprefs.gfx_display = changed_prefs.gfx_display;
+       strcpy (currprefs.gfx_display_name, changed_prefs.gfx_display_name);
        currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop;
        currprefs.win32_borderless = changed_prefs.win32_borderless;
        currprefs.win32_rtgmatchdepth = changed_prefs.win32_rtgmatchdepth;
+       currprefs.win32_rtgscaleifsmall = changed_prefs.win32_rtgscaleifsmall;
 
        inputdevice_unacquire ();
        if (c & 16) {
@@ -1098,7 +1125,6 @@ void init_colors (void)
        AVIOutput_RGBinfo (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift);
 #endif
     }
-    alloc_colors_picasso (red_bits, green_bits, blue_bits, red_shift,green_shift, blue_shift, alpha_bits, alpha_shift, alpha, 0);
 }
 
 #ifdef PICASSO96
@@ -1276,6 +1302,7 @@ void gfx_set_picasso_state (int on)
     if (screen_is_picasso == on)
        return;
     screen_is_picasso = on;
+    rp_rtg_switch ();
     memcpy (&wc, currentmode, sizeof (wc));
 
     scalepicasso = 0;
@@ -1285,17 +1312,22 @@ void gfx_set_picasso_state (int on)
     } else {
        mode = modeswitchneeded (&wc);
        if (!mode)
-           return;
+           goto end;
     }
     if (mode < 0) {
        open_windows ();
     } else {
        open_screen (); // reopen everything
     }
+end:
+#ifdef RETROPLATFORM
+    rp_set_hwnd (hAmigaWnd);
+#endif
 }
 
 void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt)
 {
+    alloc_colors_picasso (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, rgbfmt);
     if (screen_is_picasso && modeswitchneeded(currentmode))
         open_screen ();
 }
@@ -1545,7 +1577,7 @@ static int create_windows (void)
        }
 
        if (fsw) {
-           rc = Displays[currprefs.gfx_display].rect;
+           rc = getdisplay (&currprefs)->rect;
            flags |= WS_EX_TOPMOST;
            style = WS_POPUP;
            currentmode->native_width = rc.right - rc.left;
@@ -1795,9 +1827,9 @@ static BOOL doInit (void)
     }
 
 #ifdef PICASSO96
-    picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch();
-    picasso_vidinfo.pixbytes = DirectDraw_GetBytesPerPixel();
-    picasso_vidinfo.rgbformat = DirectDraw_GetPixelFormat();
+    picasso_vidinfo.rowbytes = DirectDraw_GetSurfacePitch ();
+    picasso_vidinfo.pixbytes = DirectDraw_GetBytesPerPixel ();
+    picasso_vidinfo.rgbformat = DirectDraw_GetPixelFormat ();
     picasso_vidinfo.extra_mem = 1;
     picasso_vidinfo.height = currentmode->current_height;
     picasso_vidinfo.width = currentmode->current_width;
@@ -1945,7 +1977,7 @@ void updatedisplayarea (void)
 
 void updatewinfsmode (struct uae_prefs *p)
 {
-    int i;
+    struct MultiDisplay *md;
 
     fixup_prefs_dimensions (p);
     if (p->gfx_afullscreen) {
@@ -1954,18 +1986,13 @@ void updatewinfsmode (struct uae_prefs *p)
        p->gfx_size = p->gfx_size_win;
     }
     displayGUID = NULL;
-    i = 0;
-    while (Displays[i].name) i++;
-    if (p->gfx_display >= i)
-       p->gfx_display = 0;
-    if (Displays[p->gfx_display].disabled)
+    md = getdisplay (p);
+    if (md->disabled) {
        p->gfx_display = 0;
-    if (i == 0) {
-       gui_message ("no display adapters! Exiting");
-       exit (0);
+       md = getdisplay (p);
     }
-    if (!Displays[p->gfx_display].primary)
-       displayGUID = &Displays[p->gfx_display].guid;
+    if (!md->primary)
+       displayGUID = &md->guid;
     if (isfullscreen () == 0)
        displayGUID = NULL;
 }
index 46df619bdb4fe147717abbb41c6a0eeab6ac560a..babd1eb2edbabbc40864f4a4197ae4aed2a885de 100755 (executable)
@@ -113,7 +113,6 @@ extern HWND (WINAPI *pHtmlHelp)(HWND, LPCSTR, UINT, LPDWORD);
 #define HtmlHelp(a,b,c,d) if(pHtmlHelp) (*pHtmlHelp)(a,b,c,(LPDWORD)d); else \
 { char szMessage[MAX_DPATH]; WIN32GUI_LoadUIString(IDS_NOHELP, szMessage, MAX_DPATH); gui_message(szMessage); }
 
-extern HWND hAmigaWnd;
 extern char help_file[MAX_DPATH];
 
 extern int mouseactive;
@@ -1114,6 +1113,7 @@ static void m(void)
     mm++;
 }
 
+static int GetSettings (int all_options, HWND hwnd);
 /* if drive is -1, show the full GUI, otherwise file-requester for DF[drive] */
 void gui_display (int shortcut)
 {
@@ -1125,11 +1125,11 @@ void gui_display (int shortcut)
        return;
     here++;
     gui_active++;
-    screenshot_prepare();
+    screenshot_prepare ();
 #ifdef D3D
     D3D_guimode (TRUE);
 #endif
-    setpaused();
+    setpaused ();
     inputdevice_unacquire ();
     clearallkeys ();
     setmouseactive (0);
@@ -4807,6 +4807,7 @@ static void enable_for_memorydlg (HWND hDlg)
 {
     int z3 = ! workprefs.address_space_24;
     int fast = workprefs.chipmem_size <= 0x200000;
+    int rtg = workprefs.gfxmem_size && full_property_sheet;
 
 #ifndef AUTOCONFIG
     z3 = FALSE;
@@ -4825,6 +4826,13 @@ static void enable_for_memorydlg (HWND hDlg)
     ew (hDlg, IDC_MBMEM1, z3);
     ew (hDlg, IDC_MBRAM2, z3);
     ew (hDlg, IDC_MBMEM2, z3);
+
+    ew (hDlg, IDC_RTG_8BIT, rtg);
+    ew (hDlg, IDC_RTG_16BIT, rtg);
+    ew (hDlg, IDC_RTG_24BIT, rtg);
+    ew (hDlg, IDC_RTG_32BIT, rtg);
+    ew (hDlg, IDC_RTG_MATCH_DEPTH, rtg);
+    ew (hDlg, IDC_RTG_SCALE, rtg);
 }
 
 static void values_to_memorydlg (HWND hDlg)
@@ -4902,6 +4910,45 @@ static void values_to_memorydlg (HWND hDlg)
     }
     SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETPOS, TRUE, mem_size);
     SetDlgItemText (hDlg, IDC_P96RAM, memsize_names[msi_gfx[mem_size]]);
+    SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)"(8bit)");
+    SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_ADDSTRING, 0, (LPARAM)"8-bit (*)");
+    SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_SETCURSEL, (workprefs.picasso96_modeflags & RGBFF_CLUT) ? 1 : 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"(15/16bit)");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G6B5PC (*)");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G5B5PC");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G6B5");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"R5G5B5");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"B5G6R5PC");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_ADDSTRING, 0, (LPARAM)"B5G5R5PC");
+    SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_SETCURSEL,
+       (workprefs.picasso96_modeflags & RGBFF_R5G6B5PC) ? 1 :
+       (workprefs.picasso96_modeflags & RGBFF_R5G5B5PC) ? 2 :
+       (workprefs.picasso96_modeflags & RGBFF_R5G6B5) ? 3 :
+       (workprefs.picasso96_modeflags & RGBFF_R5G5B5) ? 4 :
+       (workprefs.picasso96_modeflags & RGBFF_B5G6R5PC) ? 5 :
+       (workprefs.picasso96_modeflags & RGBFF_B5G5R5PC) ? 6 : 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"(24bit)");
+    SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"R8G8B8");
+    SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_ADDSTRING, 0, (LPARAM)"B8G8R8");
+    SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_SETCURSEL,
+       (workprefs.picasso96_modeflags & RGBFF_R8G8B8) ? 1 :
+       (workprefs.picasso96_modeflags & RGBFF_B8G8R8) ? 2 : 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_RESETCONTENT, 0, 0);
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"(32bit)");
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"A8R8G8B8");
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"A8B8G8R8");
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"R8G8B8A8");
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_ADDSTRING, 0, (LPARAM)"B8G8R8A8 (*)");
+    SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_SETCURSEL,
+       (workprefs.picasso96_modeflags & RGBFF_A8R8G8B8) ? 1 :
+       (workprefs.picasso96_modeflags & RGBFF_A8B8G8R8) ? 2 :
+       (workprefs.picasso96_modeflags & RGBFF_R8G8B8A8) ? 3 :
+       (workprefs.picasso96_modeflags & RGBFF_B8G8R8A8) ? 4 : 0, 0);
+    CheckDlgButton (hDlg, IDC_RTG_SCALE, workprefs.win32_rtgscaleifsmall);
+    CheckDlgButton (hDlg, IDC_RTG_MATCH_DEPTH, workprefs.win32_rtgmatchdepth);
 
     mem_size = 0;
     switch (workprefs.mbresmem_low_size) {
@@ -4940,51 +4987,119 @@ static void fix_values_memorydlg (void)
 
 static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
 {
+    int v;
     static int recursive = 0;
 
     switch (msg)
     {
-    case WM_INITDIALOG:
-       pages[MEMORY_ID] = hDlg;
-       currentpage = MEMORY_ID;
+       case WM_INITDIALOG:
+           pages[MEMORY_ID] = hDlg;
+           currentpage = MEMORY_ID;
 
-       SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM));
-       SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_FAST_MEM, MAX_FAST_MEM));
-       SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM));
-       SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, MAX_Z3_MEM));
-       SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM));
-       SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
-       SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
+           SendDlgItemMessage (hDlg, IDC_CHIPMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_CHIP_MEM, MAX_CHIP_MEM));
+           SendDlgItemMessage (hDlg, IDC_FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_FAST_MEM, MAX_FAST_MEM));
+           SendDlgItemMessage (hDlg, IDC_SLOWMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_SLOW_MEM, MAX_SLOW_MEM));
+           SendDlgItemMessage (hDlg, IDC_Z3FASTMEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_Z3_MEM, MAX_Z3_MEM));
+           SendDlgItemMessage (hDlg, IDC_P96MEM, TBM_SETRANGE, TRUE, MAKELONG (MIN_P96_MEM, MAX_P96_MEM));
+           SendDlgItemMessage (hDlg, IDC_MBMEM1, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
+           SendDlgItemMessage (hDlg, IDC_MBMEM2, TBM_SETRANGE, TRUE, MAKELONG (MIN_MB_MEM, MAX_MB_MEM));
 
-    case WM_USER:
-       recursive++;
-       fix_values_memorydlg ();
-       values_to_memorydlg (hDlg);
-       enable_for_memorydlg (hDlg);
-       recursive--;
+       case WM_USER:
+           recursive++;
+           fix_values_memorydlg ();
+           values_to_memorydlg (hDlg);
+           enable_for_memorydlg (hDlg);
+           recursive--;
        break;
 
-    case WM_HSCROLL:
-       workprefs.chipmem_size = memsizes[msi_chip[SendMessage (GetDlgItem (hDlg, IDC_CHIPMEM), TBM_GETPOS, 0, 0)]];
-       workprefs.bogomem_size = memsizes[msi_bogo[SendMessage (GetDlgItem (hDlg, IDC_SLOWMEM), TBM_GETPOS, 0, 0)]];
-       workprefs.fastmem_size = memsizes[msi_fast[SendMessage (GetDlgItem (hDlg, IDC_FASTMEM), TBM_GETPOS, 0, 0)]];
-       workprefs.z3fastmem_size = memsizes[msi_z3fast[SendMessage (GetDlgItem (hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0)]];
-       workprefs.gfxmem_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0)]];
-       workprefs.mbresmem_low_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM1), TBM_GETPOS, 0, 0)]];
-       workprefs.mbresmem_high_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM2), TBM_GETPOS, 0, 0)]];
-       fix_values_memorydlg ();
-       values_to_memorydlg (hDlg);
-       enable_for_memorydlg (hDlg);
+       case WM_HSCROLL:
+           workprefs.chipmem_size = memsizes[msi_chip[SendMessage (GetDlgItem (hDlg, IDC_CHIPMEM), TBM_GETPOS, 0, 0)]];
+           workprefs.bogomem_size = memsizes[msi_bogo[SendMessage (GetDlgItem (hDlg, IDC_SLOWMEM), TBM_GETPOS, 0, 0)]];
+           workprefs.fastmem_size = memsizes[msi_fast[SendMessage (GetDlgItem (hDlg, IDC_FASTMEM), TBM_GETPOS, 0, 0)]];
+           workprefs.z3fastmem_size = memsizes[msi_z3fast[SendMessage (GetDlgItem (hDlg, IDC_Z3FASTMEM), TBM_GETPOS, 0, 0)]];
+           workprefs.gfxmem_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_P96MEM), TBM_GETPOS, 0, 0)]];
+           workprefs.mbresmem_low_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM1), TBM_GETPOS, 0, 0)]];
+           workprefs.mbresmem_high_size = memsizes[msi_gfx[SendMessage (GetDlgItem (hDlg, IDC_MBMEM2), TBM_GETPOS, 0, 0)]];
+           fix_values_memorydlg ();
+           values_to_memorydlg (hDlg);
+           enable_for_memorydlg (hDlg);
        break;
 
-    case WM_COMMAND:
-       if (recursive > 0)
-           break;
-       recursive++;
-       values_to_memorydlg (hDlg);
-       recursive--;
+       case WM_COMMAND:
+       {
+           uae_u32 mask = workprefs.picasso96_modeflags;
+           if (recursive > 0)
+               break;
+           recursive++;
+           switch (LOWORD (wParam))
+           {
+               case IDC_RTG_MATCH_DEPTH:
+               workprefs.win32_rtgmatchdepth = IsDlgButtonChecked (hDlg, IDC_RTG_MATCH_DEPTH);
+               break;
+               case IDC_RTG_SCALE:
+               workprefs.win32_rtgscaleifsmall = IsDlgButtonChecked (hDlg, IDC_RTG_SCALE);
+               break;
+           }
+           if (HIWORD (wParam) == CBN_SELENDOK || HIWORD (wParam) == CBN_KILLFOCUS || HIWORD (wParam) == CBN_EDITCHANGE)  {
+               switch (LOWORD (wParam))
+               {
+                   case IDC_RTG_8BIT:
+                   v = SendDlgItemMessage (hDlg, IDC_RTG_8BIT, CB_GETCURSEL, 0, 0L);
+                   if (v != CB_ERR) {
+                       mask &= ~RGBFF_CLUT;
+                       if (v == 1)
+                           mask |= RGBFF_CLUT;
+                   }
+                   break;
+                   case IDC_RTG_16BIT:
+                   v = SendDlgItemMessage (hDlg, IDC_RTG_16BIT, CB_GETCURSEL, 0, 0L);
+                   if (v != CB_ERR) {
+                       mask &= ~(RGBFF_R5G6B5PC | RGBFF_R5G5B5PC | RGBFF_R5G6B5 | RGBFF_R5G5B5 | RGBFF_B5G6R5PC | RGBFF_B5G5R5PC);
+                       if (v == 1)
+                           mask |= RGBFF_R5G6B5PC;
+                       if (v == 2)
+                           mask |= RGBFF_R5G5B5PC;
+                       if (v == 3)
+                           mask |= RGBFF_R5G6B5;
+                       if (v == 4)
+                           mask |= RGBFF_R5G5B5;
+                       if (v == 5)
+                           mask |= RGBFF_B5G6R5PC;
+                       if (v == 6)
+                           mask |= RGBFF_B5G5R5PC;
+                   }
+                   break;
+                   case IDC_RTG_24BIT:
+                   v = SendDlgItemMessage (hDlg, IDC_RTG_24BIT, CB_GETCURSEL, 0, 0L);
+                   if (v != CB_ERR) {
+                       mask &= ~(RGBFF_R8G8B8 | RGBFF_B8G8R8);
+                       if (v == 1)
+                           mask |= RGBFF_R8G8B8;
+                       if (v == 2)
+                           mask |= RGBFF_B8G8R8;
+                   }
+                   break;
+                   case IDC_RTG_32BIT:
+                   v = SendDlgItemMessage (hDlg, IDC_RTG_32BIT, CB_GETCURSEL, 0, 0L);
+                   if (v != CB_ERR) {
+                       mask &= ~(RGBFF_A8R8G8B8 | RGBFF_A8B8G8R8 | RGBFF_R8G8B8A8 | RGBFF_B8G8R8A8);
+                       if (v == 1)
+                           mask |= RGBFF_A8R8G8B8;
+                       if (v == 2)
+                           mask |= RGBFF_A8B8G8R8;
+                       if (v == 3)
+                           mask |= RGBFF_R8G8B8A8;
+                       if (v == 4)
+                           mask |= RGBFF_B8G8R8A8;
+                   }
+                   break;
+               }
+           }
+           workprefs.picasso96_modeflags = mask;
+           values_to_memorydlg (hDlg);
+           recursive--;
+       }
        break;
-
     }
     return FALSE;
 }
@@ -5206,6 +5321,7 @@ static INT_PTR CALLBACK KickstartDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LP
 
 static void enable_for_miscdlg (HWND hDlg)
 {
+    ew (hDlg, IDC_DD_SURFACETYPE, full_property_sheet);
     if (!full_property_sheet) {
        ew (hDlg, IDC_JULIAN, TRUE);
        ew (hDlg, IDC_CTRLF11, TRUE);
@@ -5214,7 +5330,6 @@ static void enable_for_miscdlg (HWND hDlg)
        ew (hDlg, IDC_NOSPEED, TRUE);
        ew (hDlg, IDC_NOSPEEDPAUSE, TRUE);
        ew (hDlg, IDC_NOSOUND, TRUE);
-       ew (hDlg, IDC_RTGMATCHDEPTH, TRUE);
        ew (hDlg, IDC_DOSAVESTATE, TRUE);
        ew (hDlg, IDC_SCSIMODE, FALSE);
        ew (hDlg, IDC_SCSIDEVICE, FALSE);
@@ -5362,7 +5477,6 @@ static void values_to_miscdlg (HWND hDlg)
        CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse);
        CheckDlgButton (hDlg, IDC_CREATELOGFILE, workprefs.win32_logfile);
        CheckDlgButton (hDlg, IDC_CTRLF11, workprefs.win32_ctrl_F11_is_quit);
-       CheckDlgButton (hDlg, IDC_RTGMATCHDEPTH, workprefs.win32_rtgmatchdepth);
        CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen);
        CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi == 1);
        CheckDlgButton (hDlg, IDC_SANA2, workprefs.sana2);
@@ -5404,6 +5518,13 @@ static void values_to_miscdlg (HWND hDlg)
        misc_scsi(hDlg);
        misc_lang(hDlg);
 
+       SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_RESETCONTENT, 0, 0);
+       SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"NonLocalVRAM");
+       SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"DefaultRAM");
+       SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"LocalVRAM");
+       SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_ADDSTRING, 0, (LPARAM)"SystemRAM");
+       SendDlgItemMessage (hDlg, IDC_DD_SURFACETYPE, CB_SETCURSEL, ddforceram, 0);
+
     } else if (currentpage == MISC2_ID) {
 
        CheckDlgButton (hDlg, IDC_INACTIVE_PAUSE, workprefs.win32_inactive_pause);
@@ -5492,6 +5613,13 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
                            misc_setlang(v);
                    }
                    break;
+                   case IDC_DD_SURFACETYPE:
+                   v = SendDlgItemMessage(hDlg, IDC_DD_SURFACETYPE, CB_GETCURSEL, 0, 0L);
+                   if (v != CB_ERR) {
+                       ddforceram = v;
+                       regsetint (NULL, "directdraw_secondary", ddforceram);
+                   }
+                   break;
                }
            }
        } else if (currentpage == MISC2_ID) {
@@ -5523,9 +5651,6 @@ static INT_PTR MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
        case IDC_JULIAN:
            workprefs.win32_middle_mouse = IsDlgButtonChecked(hDlg, IDC_JULIAN);
            break;
-       case IDC_RTGMATCHDEPTH:
-           workprefs.win32_rtgmatchdepth = IsDlgButtonChecked(hDlg, IDC_RTGMATCHDEPTH);
-           break;
        case IDC_SHOWLEDS:
            workprefs.leds_on_screen = IsDlgButtonChecked(hDlg, IDC_SHOWLEDS);
            break;
index 5716ea2e6d77794ce9104eedd697680d864eca64..ed56cc6a81244a9a610cb8d53be6a1d07cd494f9 100755 (executable)
@@ -10,7 +10,6 @@
 #define CONFIG_DELETE 4
 
 void WIN32GUI_LoadUIString( DWORD id, char *string, DWORD dwStringLen );
-extern int GetSettings (int all_options, HWND);
 extern int DiskSelection( HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs, char *);
 void InitializeListView( HWND hDlg );
 extern void pre_gui_message (const char*,...);
index 6a92e19a6f43cd6230dea1eb023316c6cf985d53..a3d4c854b55a20b5b53b136cc1fdabeedffd678b 100755 (executable)
                        >
                </File>
                <File
-                       RelativePath="..\resources\resource.h"
+                       RelativePath="..\resources\resource"
                        >
                </File>
        </Files>
index 5c7bada8e364cd416eab1aff94726018b81aa52d..db554bd7fe0c54a7f0fef3381c20c74803ab4c53 100755 (executable)
@@ -1,4 +1,29 @@
 
+Beta 11:
+
+- uaegfx.card is now WinUAE built-in, libs:picasso96/uaegfx.card is not
+  needed anymore (and is ignored if it exists)
+- resolution names in display preferences are now named
+  "UAE:<w>x<h>" instead of "uaegfx:<w>x<h>"
+- added new Picasso96 options to GUI
+- 24-bit display depth Picasso96 blitter routines implemented/updated
+- added all Picasso96 supported color depth modes, defaults are
+  old standard PC modes (palette mode, R5G6B5PC and B8G8R8A8)
+  NOTES:
+  - only one 8-bit,15/16-bit, 24-bit and 32-bit mode supported
+  simultaneously
+  - All "new" modes require color space conversion = slower.
+  - Not all mode color space conversions yet supported (black screen)
+  - Can be useful with old RTG compatible demos or games that require
+    specific "non-pc" display color modes
+- added "Display buffer" option to misc-panel (stored to registry)
+- "FS" scale setting is now the default
+- refresh whole screen using very optimized routine if >80% of
+  Picasso96 screen needs refreshing (faster than partial update)
+- Marvin's Marvellous Adventure clouds/score interference fixed
+  (It was really stupid bug, can only happen with AGA sprites)
+- Skid Marks hires mode car sprite problem fixed (b10)
+
 Beta 10:
 
 - MOVEM is not weird in debugger anymore
@@ -11,8 +36,11 @@ Beta 10:
   was shorter than expected
 - disable hardware sprite if uaegfx.card is old version without
   hardware sprite support and devs:monitors/info has softsprite=no
-- added -ddforceram and -ddforcevram debugging command line params
-  try -ddforceram if you have slow P96Speed results
+- adjusted DirectDraw surface allocation parameters, perhaps helps
+  with P96Speed differences
+- added -ddforcemode <mode> command line parameter, if you have slow
+  P96Speed results compared to 1.4.6, try mode values from 1 to 3 and
+  report results.
 
 Beta 9:
 
index 4272bd1042118ff936f5f261421296477b9cd7d8..660f7313518b2068774d17cd61fccdaca3f170a1 100755 (executable)
@@ -304,7 +304,7 @@ void write_log (const char *format, ...)
            fprintf(debugfile, ts);
        fprintf(debugfile, bufp);
        if (!bootlogmode)
-           fflush(debugfile);
+           ;//fflush(debugfile);
     }
     lfdetected = 0;
     if (strlen(bufp) > 0 && bufp[strlen(bufp) - 1] == '\n')
index 62f790d16733c3271241ff33a31898a2d9e686a2..5aaf1d27b09cdc1393520ff2772d9b880245d088 100755 (executable)
@@ -1,4 +1,39 @@
 
+#if BLT_SIZE == 3
+static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_u8 *dst, int srcpitch, int dstpitch)
+{
+    uae_u8 *src2 = src;
+    uae_u8 *dst2 = dst;
+    uae_u32 *src2_32 = (uae_u32*)src;
+    uae_u32 *dst2_32 = (uae_u32*)dst;
+    unsigned int y, x, ww, xxd;
+#ifdef BLT_TEMP
+    uae_u32 tmp;
+#endif
+    w *= BLT_SIZE;
+    ww = w / 4;
+    xxd = w - (ww * 4);
+    for(y = 0; y < h; y++) {
+       uae_u8 *src_8;
+       uae_u8 *dst_8;
+        uae_u32 *src_32 = (uae_u32*)src2;
+        uae_u32 *dst_32 = (uae_u32*)dst2;
+        for (x = 0; x < ww; x++) {
+           BLT_FUNC (src_32, dst_32);
+           src_32++; dst_32++;
+       }
+       src_8 = (uae_u8*)src_32;
+       dst_8 = (uae_u8*)dst_32;
+       for (x = 0; x < xxd; x++) {
+           BLT_FUNC (src_8, dst_8);
+           src_8++;
+           dst_8++;
+       }
+       dst2 += dstpitch;
+       src2 += srcpitch;
+    }
+}
+#else
 static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_u8 *dst, int srcpitch, int dstpitch)
 {
     uae_u8 *src2 = src;
@@ -98,6 +133,7 @@ static void NOINLINE BLT_NAME (unsigned int w, unsigned int h, uae_u8 *src, uae_
        src2 += srcpitch;
     }
 }
+#endif
 #undef BLT_NAME
 #undef BLT_FUNC
 #ifdef BLT_TEMP