]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
imported winuaesrc0992b6.zip
authorToni Wilen <twilen@winuae.net>
Thu, 25 Nov 2004 16:31:13 +0000 (18:31 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 22 Feb 2010 19:24:40 +0000 (21:24 +0200)
24 files changed:
blitter.c
custom.c
disk.c
drawing.c
filesys.c
include/options.h
inputdevice.c
newcpu.c
od-win32/ahidsound.c
od-win32/ahidsound.h
od-win32/caps/caps_win32.c
od-win32/dinput.c
od-win32/dxwrap.c
od-win32/dxwrap.h
od-win32/keyboard_win32.c
od-win32/parser.c
od-win32/picasso96_win.c
od-win32/resources/resource.h
od-win32/resources/winuae.rc
od-win32/win32.c
od-win32/win32.h
od-win32/win32gfx.c
od-win32/win32gui.c
savestate.c

index 01208940d251d4d7a4bb1ab9c3e08370d9f00c3b..1e512c0ebb8477db306547a4ebf4fc135e88fd4b 100755 (executable)
--- a/blitter.c
+++ b/blitter.c
@@ -707,10 +707,8 @@ void decide_blitter (int hpos)
 {
     if (bltstate == BLT_done)
        return;
-    if (!currprefs.blitter_cycle_exact) {
-        blitter_handler ();
+    if (!currprefs.blitter_cycle_exact)
        return;
-    }
     if (blitline) {
        decide_blitter_line (hpos);
        return;
@@ -888,7 +886,6 @@ void do_blitter (int hpos)
 #ifdef BLITTER_DEBUG
     int oldstate = bltstate;
 #endif
-
     blt_info.blitzero = 1;
     bltstate = BLT_init;
     preva = 0;
index c2f760430eeb55ac1a017b2e769c8cd8e355da0a..a8ca451ffe9aaf29d0097cabe45dfe176b4a9cd5 100755 (executable)
--- a/custom.c
+++ b/custom.c
@@ -2172,6 +2172,11 @@ static void reset_decisions (void)
 
 }
 
+static int isvsync (void)
+{
+    return currprefs.gfx_vsync && currprefs.gfx_afullscreen;
+}
+
 int vsynctime_orig;
 int turbo_emulation;
 
@@ -2180,7 +2185,7 @@ void compute_vsynctime (void)
     fake_vblank_hz = 0;
     if (currprefs.chipset_refreshrate) {
        vblank_hz = currprefs.chipset_refreshrate;
-       if (currprefs.gfx_vsync && currprefs.gfx_afullscreen) {
+       if (isvsync()) {
            vblank_skip = 1;
            if (!fake_vblank_hz && vblank_hz > 85) {
                vblank_hz /= 2;
@@ -2270,7 +2275,8 @@ void init_hz (void)
 #ifdef PICASSO96
     init_hz_p96 ();
 #endif
-    write_log ("%s mode, %dHz\n", isntsc ? "NTSC" : "PAL", vblank_hz);
+    write_log ("%s mode, %dHz (h=%d v=%d)\n",
+       isntsc ? "NTSC" : "PAL", vblank_hz, maxhpos, maxvpos);
 }
 
 static void calcdiw (void)
@@ -2738,6 +2744,7 @@ STATIC_INLINE void BPLCON1 (int hpos, uae_u16 v)
        v &= 0xff;
     if (bplcon1 == v)
        return;
+    ddf_change = vpos;
     decide_line (hpos);
     decide_fetch (hpos);
     bplcon1 = v;
@@ -4171,12 +4178,14 @@ static void framewait (void)
         double v = rpt_vsync () / (syncbase / 1000.0);
        if (v >= -4)
            break;
-        sleep_millis_busy (1);
+        sleep_millis_busy (2);
+    }
+    curr_time = start = read_processor_time();
+    if (!isvsync()) {
+       do {
+           curr_time = read_processor_time ();
+       } while (rpt_vsync () < 0);
     }
-    start = read_processor_time();
-    do {
-        curr_time = read_processor_time ();
-    } while (rpt_vsync () < 0);
     vsyncmintime = curr_time + vsynctime;
     idletime += read_processor_time() - start;
 }
@@ -4231,7 +4240,7 @@ static void vsync_handler (void)
 {
     fpscounter ();
 
-    if ((!currprefs.gfx_vsync || !currprefs.gfx_afullscreen)
+    if (!isvsync()
 #ifdef AVIOUTPUT
        && ((avioutput_framelimiter && avioutput_enabled) || !avioutput_enabled)
 #endif
@@ -4404,7 +4413,6 @@ static void hsync_handler (void)
 
 #ifdef CPUEMU_6
     if (currprefs.cpu_cycle_exact || currprefs.blitter_cycle_exact) {
-       int i;
         decide_blitter (hpos);
        memset (cycle_line, 0, MAXHPOS);
 #if 1
@@ -4413,12 +4421,15 @@ static void hsync_handler (void)
        cycle_line[4] = CYCLE_REFRESH;
        cycle_line[6] = CYCLE_REFRESH;
 #else
+{
+       int i;
        cycle_line[4] = CYCLE_REFRESH;
        cycle_line[6] = CYCLE_REFRESH;
        cycle_line[8] = CYCLE_REFRESH;
        cycle_line[10] = CYCLE_REFRESH;
        for (i = 12; i < 0x16; i += 2)
            cycle_line[i] = CYCLE_NOCPU;
+}
 #endif
     }
 #endif
@@ -5621,6 +5632,12 @@ STATIC_INLINE void sync_copper (int hpos)
        update_copper (hpos);
 }
 
+STATIC_INLINE decide_fetch_ce (int hpos)
+{
+    if (ddf_change == vpos)
+       decide_fetch (hpos);
+}
+
 STATIC_INLINE int dma_cycle(void)
 {
     int hpos, cycles = 0, bnasty = 0;
@@ -5633,7 +5650,7 @@ STATIC_INLINE int dma_cycle(void)
         hpos = current_hpos ();
        sync_copper (hpos);
        decide_line (hpos);
-        decide_fetch (hpos);
+        decide_fetch_ce (hpos);
        bpldma = is_bitplane_dma (hpos);
        if (cycle_line[hpos] == 0 && !bpldma) {
            if (bltstate == BLT_done || bnasty >= 3)
@@ -5695,7 +5712,7 @@ void do_cycles_ce (long cycles)
         hpos = current_hpos ();
        sync_copper (hpos);
        decide_line (hpos);
-        decide_fetch (hpos);
+        decide_fetch_ce (hpos);
        bpldma = is_bitplane_dma (hpos);
        if (cycle_line[hpos] == 0 && !bpldma)
            decide_blitter (hpos);
diff --git a/disk.c b/disk.c
index ec079d740535a8879b83e484c111919d5d1cb3a2..860318e0933724e747e14a3e378ea4469126920e 100755 (executable)
--- a/disk.c
+++ b/disk.c
@@ -1413,13 +1413,13 @@ static int decode_buffer (uae_u16 *mbuf, int cyl, int drvsec, int ddhd, int file
            *secdata++ = dlong;
            chksum ^= odd ^ even;
        }
-       mbuf += 256;
        if (chksum) {
            write_log ("Disk decode: sector %d, data checksum error\n", trackoffs);
            if (filetype == ADF_EXT2)
                return 4;
            continue;
        }
+       mbuf += 256;
        sectable[trackoffs] = 1;
        secwritten++;
        memcpy (writebuffer + trackoffs * 512, secbuf + 32, 512);
index e11600a34c64ee4e7d774c8479f93f599a234bd8..b8e7f7dde4f803d6927911ca4f88983f721c26a2 100755 (executable)
--- a/drawing.c
+++ b/drawing.c
@@ -1,3 +1,5 @@
+//#define XLINECHECK
+
  /*
   * UAE - The Un*x Amiga Emulator
   *
@@ -117,6 +119,21 @@ union sps_union spixstate;
 static uae_u32 ham_linebuf[MAX_PIXELS_PER_LINE * 2];
 
 char *xlinebuffer;
+#ifdef XLINECHECK
+char *xlinebuffer_start, *xlinebuffer_end;
+static void xlinecheck (int start, int end)
+{
+    char *xstart = xlinebuffer + start * gfxvidinfo.pixbytes;
+    char *xend = xlinebuffer + end * gfxvidinfo.pixbytes;
+    if (xstart < xlinebuffer_start || xstart > xlinebuffer_end ||
+       xend < xlinebuffer_start || xend > xlinebuffer_end)
+           write_log ("*** %dx%d (%dx%dx%d) %p %p %p\n",
+               start, end, gfxvidinfo.width, gfxvidinfo.height, gfxvidinfo.pixbytes,
+               xlinebuffer, xlinebuffer_start, xlinebuffer_end);
+}
+#else
+#define xlinecheck
+#endif
 
 static int *amiga2aspect_line_map, *native2amiga_line_map;
 static char *row_map[MAX_VIDHEIGHT + 1];
@@ -578,6 +595,7 @@ static void pfield_do_linetoscr (int start, int stop)
 
 static void pfield_do_fill_line (int start, int stop)
 {
+    xlinecheck(start, stop);
     switch (gfxvidinfo.pixbytes) {
     case 1: fill_line_8 (xlinebuffer, start, stop); break;
     case 2: fill_line_16 (xlinebuffer, start, stop); break;
@@ -590,6 +608,7 @@ static void pfield_do_linetoscr_full (int double_line)
     char *oldxlb = (char *)xlinebuffer;
     int old_src_pixel = src_pixel;
 
+    xlinecheck(playfield_start, playfield_end);
     pfield_do_linetoscr (playfield_start, playfield_end);
     xlinebuffer = oldxlb + linetoscr_double_offset;
     src_pixel = old_src_pixel;
@@ -1111,13 +1130,14 @@ static void pfield_doline (int lineno)
 
 void init_row_map (void)
 {
-    int i;
+    int i, j;
     if (gfxvidinfo.height > MAX_VIDHEIGHT) {
        write_log ("Resolution too high, aborting\n");
        abort ();
     }
-    for (i = 0; i < gfxvidinfo.height + 1; i++)
-       row_map[i] = gfxvidinfo.bufmem + gfxvidinfo.rowbytes * i;
+    j = 0;
+    for (i = 0; i < gfxvidinfo.height + 1; i++, j += gfxvidinfo.rowbytes)
+       row_map[i] = gfxvidinfo.bufmem + j;
 }
 
 static void init_aspect_maps (void)
@@ -1420,8 +1440,13 @@ STATIC_INLINE void pfield_draw_line (int lineno, int gfx_ypos, int follow_ypos)
        xlinebuffer = gfxvidinfo.emergmem, dh = dh_emerg;
     if (xlinebuffer == 0)
        xlinebuffer = row_map[gfx_ypos], dh = dh_buf;
+#ifdef XLINECHECK
+    xlinebuffer_start =  xlinebuffer;
+    xlinebuffer_end = xlinebuffer + gfxvidinfo.width * gfxvidinfo.pixbytes;
+#endif
     xlinebuffer -= linetoscr_x_adjust_bytes;
 
+
     if (border == 0) {
        pfield_expand_dp_bplcon ();
 
index 7397cd1aab731a498279046ee50c7119145e0ebb..072582f1c34327738e085e1b6431c99c7b4ee149 100755 (executable)
--- a/filesys.c
+++ b/filesys.c
@@ -2946,6 +2946,7 @@ action_delete_object (Unit *unit, dpacket packet)
     updatedirtime (a, 1);
     if (a->child != 0) {
        write_log ("Serious error in action_delete_object.\n");
+       a->deleted = 1;
     } else {
        delete_aino (unit, a);
     }
index 93a864111b9448afbf7c6f57debc5312aeb4a007..d5a280caa122ae42fd7685d676461696fea5c401 100755 (executable)
@@ -202,6 +202,7 @@ struct uae_prefs {
     int win32_middle_mouse;
     int win32_logfile;
     int win32_notaskbarbutton;
+    int win32_alwaysontop;
 
     int win32_active_priority;
     int win32_inactive_priority;
index bf68ab28418bfda4e5f848cbe9fe6e31b8c27c44..26f93682c4976d7e18f1cef0c2ea838f984aceb9 100755 (executable)
@@ -1179,7 +1179,6 @@ void inputdevice_handle_inputcode (void)
        return;
     if (vpos != 0)
        write_log ("inputcode=%d but vpos = %d", code, vpos);
-
     switch (code)
     {
        case AKS_ENTERGUI:
@@ -1272,7 +1271,7 @@ void inputdevice_handle_inputcode (void)
        case AKS_STATERESTOREQUICK7:
        case AKS_STATERESTOREQUICK8:
        case AKS_STATERESTOREQUICK9:
-       savestate_quick ((code - AKS_STATESAVEQUICK) / 2, 0);
+       savestate_quick ((code - AKS_STATERESTOREQUICK) / 2, 0);
        break;
        case AKS_TOGGLEFULLSCREEN:
        fullscreentoggle ();
index 6b87b7f934cf726c8381ee81e765de68783e7dc4..0a1637d9b07c5260e7c51e4eaa4eafadda1273e7 100755 (executable)
--- a/newcpu.c
+++ b/newcpu.c
@@ -1637,6 +1637,8 @@ static void do_trace (void)
     }
 }
 
+#define IDLETIME (currprefs.cpu_idle * sleep_resolution / 1000)
+
 static int do_specialties (int cycles)
 {
     #ifdef ACTION_REPLAY
@@ -1725,11 +1727,11 @@ static int do_specialties (int cycles)
                    sleepcnt--;
                    if (pissoff == 0 && compiled_code && --zerocnt < 0) {
                        sleepcnt = -1;
-                       zerocnt = (currprefs.cpu_idle * sleep_resolution / 1000) / 4;
+                       zerocnt = IDLETIME / 4;
                    }
                    lvpos = vpos;
                    if (sleepcnt < 0) {
-                       sleepcnt = (currprefs.cpu_idle * sleep_resolution / 1000) / 2;
+                       sleepcnt = IDLETIME / 2;
                        sleep_millis (1);
                    }
                }
index a69cebe9ccb26d700b8ddf604f1ffde1e1274526..df9c25ba44d8bc0a6a6e2f6162ea6ff918371dd3 100755 (executable)
@@ -67,9 +67,10 @@ static char *ahisndbuffer,*sndrecbuffer;
 static int ahisndbufsize,oldpos,*ahisndbufpt,ahitweak;;
 static unsigned int dwBytes,dwBytes1,dwBytes2,espstore;
 static LPVOID dwData1,dwData2;
+int ahi_pollrate;
 
 int sound_freq_ahi;
-       
+
 static int vin,devicenum;
 static int amigablksize;
 
@@ -717,12 +718,11 @@ switch (opcode) {
        extern int p96hack_vpos2,hack_vpos,p96refresh_active;
        extern uae_u16 vtotal;
        extern unsigned int new_beamcon0;
-       p96hack_vpos2=15625/m68k_dreg (regs, 1);
+       p96hack_vpos2 = 0;
+       if (m68k_dreg (regs, 1) > 0)
+           p96hack_vpos2 = 15625 / m68k_dreg (regs, 1);
        p96refresh_active=1;
-       if (!picasso_on)return 0;
-       vtotal=p96hack_vpos2;           // only do below if P96 screen is visible
-       new_beamcon0 |= 0x80;              
-       hack_vpos=vtotal;                  
+       picasso_refresh (0);
         } //end for higher P96 mouse draw rate
       return 0;
 
@@ -894,8 +894,13 @@ switch (opcode) {
                bswap_buffer = NULL;
                return 0;       
        case 200:
-     ahitweak = m68k_dreg (regs, 1);
-        return 1;
+       ahitweak = m68k_dreg (regs, 1);
+       ahi_pollrate = m68k_dreg (regs, 2);
+       if (ahi_pollrate < 10)
+           ahi_pollrate = 10;
+       if (ahi_pollrate > 60)
+           ahi_pollrate = 60;
+       return 1;
        default:
        return 0x12345678;     // Code for not supportet function
        }
index 108bdbdc2c6830c1fa6934dd62a4f8054a7f583c..cd33aaa93cbc630cdc04944a8ffc68b323f0416d 100755 (executable)
@@ -5,5 +5,4 @@ extern void ahi_close_sound (void);
 extern void ahi_finish_sound_buffer( void );
 
 extern int ahi_on;
-
-
+extern int ahi_pollrate;
\ No newline at end of file
index 9796f81fd35b937c0ba37aa90934502f1407fb7d..6b7aaafd3c865c74e9413aa03f3d1e569d45ba27 100755 (executable)
@@ -181,7 +181,7 @@ int caps_loadtrack (uae_u16 *mfmbuf, uae_u16 *tracktiming, int drv, int track, i
     type = ci.type & CTIT_MASK_TYPE;
     len = ci.tracklen;
     *tracklength = len * 8;
-    *gapoffset = ci.overlap * 8;
+    *gapoffset = ci.overlap >= 0 ? ci.overlap * 8 : -1;
     for (i = 0; i < (len + 1) / 2; i++) {
         uae_u8 *data = ci.trackbuf + i * 2;
         *mfm++ = 256 * *data + *(data + 1);
index 50ce2b0691fb2838c7fc924de1c8a24ad2ba6f80..69ed605f1708285a9c9ab1f26715464b20da3e7d 100755 (executable)
@@ -1122,8 +1122,6 @@ static int init_kb (void)
     LPDIRECTINPUTDEVICE8 lpdi;
     DIPROPDWORD dipdw;
     HRESULT hr;
-    HKL keyboardlayoutid;
-    WORD keyboardlangid;
 
     if (keyboard_inited)
        return 1;
@@ -1155,14 +1153,9 @@ static int init_kb (void)
                write_log ("keyboard CreateDevice failed, %s\n", DXError (hr));
        }
     }
-    keyboardlayoutid = GetKeyboardLayout(0);      
-    keyboardlangid = LOWORD(keyboardlayoutid);
     keyboard_german = 0;
-    if (keyboardlangid == 0x0407) keyboard_german = 1; //German Standard
-    if (keyboardlangid == 0x0807) keyboard_german = 1; //German Switzerland
-    if (keyboardlangid == 0x0c07) keyboard_german = 1; //German Austria
-    if (keyboardlangid == 0x1007) keyboard_german = 1; //German Louxembourg
-    if (keyboardlangid == 0x1407) keyboard_german = 1; //German Lichtenstein
+    if ((LOWORD(GetKeyboardLayout(0)) & 0x3ff) == 7)
+       keyboard_german = 1;
     return 1;
 }
 
@@ -1426,7 +1419,6 @@ static int acquire_kb (int num, int flags)
     LPDIRECTINPUTDEVICE8 lpdi = di_keyboard[num].lpdi;
 
     unacquire (lpdi, "keyboard");
-
     if (currprefs.keyboard_leds_in_use) {
 #ifdef WINDDK
        if (os_winnt && !usbledmode) {
index 9b52d9a2a4af13ac3b05401718f0faeeca39ebe7..96ffc264707f1a5b171172728983a5330faf872f 100755 (executable)
@@ -70,6 +70,39 @@ static int restoresurface (LPDIRECTDRAWSURFACE7 surface)
     }
     return hr;
 }
+
+
+/*
+ * FUNCTION:
+ *
+ * PURPOSE:
+ *
+ * PARAMETERS:
+ *
+ * RETURNS:
+ *
+ * NOTES:
+ *
+ * HISTORY:
+ *   1999.08.02  Brian King             Creation
+ *
+ */
+static void clearsurface(int surface)
+{
+    DDBLTFX ddbltfx;
+    memset(&ddbltfx, 0, sizeof(ddbltfx));
+    ddbltfx.dwFillColor = 0;
+    ddbltfx.dwSize = sizeof(ddbltfx);
+    DirectDraw_Blt(surface, NULL, invalid_surface, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx);
+}
+
+void DirectDraw_ClearSurfaces(void)
+{
+    clearsurface(secondary_surface);
+    if(DirectDrawState.isoverlay)
+       clearsurface(overlay_surface);
+}
+
 /*
  * FUNCTION:ShowDDCaps
  *
@@ -941,12 +974,13 @@ static DWORD ConvertGDIColor( COLORREF dwGDIColor )
 }
 
 
-HRESULT DirectDraw_CreateOverlaySurface( int width, int height, int bits)
+HRESULT DirectDraw_CreateOverlaySurface(int width, int height, int bits, int type)
 {
     DDSURFACEDESC2 ddsd;
     DDPIXELFORMAT ddpfOverlayFormat;
     HRESULT ddrval = DDERR_UNSUPPORTED;
     DWORD dwDDSColor;
+    DWORD flags = DDPF_RGB;
 
     if( bOverlayAvailable )
     {
@@ -956,7 +990,7 @@ HRESULT DirectDraw_CreateOverlaySurface( int width, int height, int bits)
            // Set the overlay format to 16 bit RGB 5:6:5
            ZeroMemory( &ddpfOverlayFormat, sizeof(ddpfOverlayFormat) );
            ddpfOverlayFormat.dwSize        = sizeof(ddpfOverlayFormat);
-           ddpfOverlayFormat.dwFlags       = DDPF_RGB;
+           ddpfOverlayFormat.dwFlags       = flags;
            ddpfOverlayFormat.dwRGBBitCount = 16;
            ddpfOverlayFormat.dwRBitMask    = 0xF800; 
            ddpfOverlayFormat.dwGBitMask    = 0x07E0;
@@ -967,7 +1001,7 @@ HRESULT DirectDraw_CreateOverlaySurface( int width, int height, int bits)
            // Set the overlay format to 32 bit ARGB 8:8:8:8
            ZeroMemory( &ddpfOverlayFormat, sizeof(ddpfOverlayFormat) );
            ddpfOverlayFormat.dwSize        = sizeof(ddpfOverlayFormat);
-           ddpfOverlayFormat.dwFlags       = DDPF_RGB;
+           ddpfOverlayFormat.dwFlags       = flags;
            ddpfOverlayFormat.dwRGBBitCount = 32;
            ddpfOverlayFormat.dwRBitMask    = 0x00FF0000; 
            ddpfOverlayFormat.dwGBitMask    = 0x0000FF00;
@@ -978,7 +1012,7 @@ HRESULT DirectDraw_CreateOverlaySurface( int width, int height, int bits)
            // Set the overlay format to 8 bit palette
            ZeroMemory( &ddpfOverlayFormat, sizeof(ddpfOverlayFormat) );
            ddpfOverlayFormat.dwSize        = sizeof(ddpfOverlayFormat);
-           ddpfOverlayFormat.dwFlags       = DDPF_RGB | DDPF_PALETTEINDEXED8;
+           ddpfOverlayFormat.dwFlags       = flags | DDPF_PALETTEINDEXED8;
            ddpfOverlayFormat.dwRGBBitCount = 8;
            ddpfOverlayFormat.dwRBitMask    = 0x00000000; 
            ddpfOverlayFormat.dwGBitMask    = 0x00000000;
@@ -1003,12 +1037,12 @@ HRESULT DirectDraw_CreateOverlaySurface( int width, int height, int bits)
        overlayfx.dwSize = sizeof(overlayfx);
        overlayflags = DDOVER_SHOW | DDOVER_DDFX | DDOVER_KEYDESTOVERRIDE;
 
-       dwDDSColor = ConvertGDIColor( g_dwBackgroundColor );
+       dwDDSColor = ConvertGDIColor(g_dwBackgroundColor);
        overlayfx.dckDestColorkey.dwColorSpaceLowValue  = dwDDSColor;
        overlayfx.dckDestColorkey.dwColorSpaceHighValue = dwDDSColor;
 
        // Attempt to create the surface with theses settings
-       ddrval = IDirectDraw7_CreateSurface ( DirectDrawState.directdraw.dd, &ddsd, &DirectDrawState.overlay.surface, NULL);
+       ddrval = IDirectDraw7_CreateSurface (DirectDrawState.directdraw.dd, &ddsd, &DirectDrawState.overlay.surface, NULL);
        if( ddrval == DD_OK )
        {
            DirectDrawState.isoverlay = 1;
@@ -1047,46 +1081,41 @@ HRESULT DirectDraw_CreateSurface( int width, int height )
 
     DirectDrawState.flipping = single_buffer;
 
-    if( DirectDrawState.fullscreen ) // Create a flipping pair!
+    if (DirectDrawState.fullscreen) // Create a flipping pair!
     {
-       ZeroMemory( &DirectDrawState.primary.desc, sizeof( DDSURFACEDESC2 ) );
-       DirectDrawState.primary.desc.dwSize = sizeof( DDSURFACEDESC2 );
+       ZeroMemory (&DirectDrawState.primary.desc, sizeof(DDSURFACEDESC2));
+       DirectDrawState.primary.desc.dwSize = sizeof (DDSURFACEDESC2);
        DirectDrawState.primary.desc.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
        DirectDrawState.primary.desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
        DirectDrawState.primary.desc.dwBackBufferCount = 2;
-       ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, 
+       ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd, 
                                            &DirectDrawState.primary.desc,
                                            &DirectDrawState.primary.surface,
-                                           NULL );
-       if( ddrval != DD_OK )
-       {
+                                           NULL);
+       if (ddrval != DD_OK) {
            // Create a non-flipping pair, since the flipping pair creation failed...
-           ZeroMemory( &DirectDrawState.primary.desc, sizeof( DDSURFACEDESC2 ) );
-           DirectDrawState.primary.desc.dwSize = sizeof( DDSURFACEDESC2 );
+           ZeroMemory (&DirectDrawState.primary.desc, sizeof(DDSURFACEDESC2));
+           DirectDrawState.primary.desc.dwSize = sizeof(DDSURFACEDESC2);
            DirectDrawState.primary.desc.dwFlags = DDSD_CAPS;
            DirectDrawState.primary.desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-           ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, 
+           ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd, 
                                                &DirectDrawState.primary.desc,
                                                &DirectDrawState.primary.surface,
-                                               NULL );
-       }
-       else
-       {
+                                               NULL);
+       } else {
            DirectDrawState.flipping = triple_buffer;
        }
-    }
-    else
-    {
+        clearsurface (primary_surface);
+    } else {
        // We're not full-screen, so you cannot create a flipping pair...
-
-       ZeroMemory( &DirectDrawState.primary.desc, sizeof( DDSURFACEDESC2 ) );
-       DirectDrawState.primary.desc.dwSize = sizeof( DDSURFACEDESC2 );
+       ZeroMemory( &DirectDrawState.primary.desc, sizeof(DDSURFACEDESC2));
+       DirectDrawState.primary.desc.dwSize = sizeof(DDSURFACEDESC2);
        DirectDrawState.primary.desc.dwFlags = DDSD_CAPS;
        DirectDrawState.primary.desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-       ddrval = IDirectDraw7_CreateSurface( DirectDrawState.directdraw.dd, 
+       ddrval = IDirectDraw7_CreateSurface(DirectDrawState.directdraw.dd, 
                                            &DirectDrawState.primary.desc,
                                            &DirectDrawState.primary.surface,
-                                           NULL );
+                                           NULL);
     }
 
     if( ddrval != DD_OK )
@@ -1115,6 +1144,7 @@ HRESULT DirectDraw_CreateSurface( int width, int height )
            ddrval = IDirectDrawSurface7_GetAttachedSurface( DirectDrawState.secondary.surface, &ddSCaps, &DirectDrawState.tertiary.surface );
            if( ddrval == DD_OK )
            {
+               clearsurface (tertiary_surface);
     #if 0
                // Get our IDirectDrawSurface7 pointer
                ddrval = IDirectDrawSurface7_QueryInterface( DirectDrawState.tertiary.surface,
@@ -1209,33 +1239,6 @@ out:
     return ddrval;
 }
 
-/*
- * FUNCTION:
- *
- * PURPOSE:
- *
- * PARAMETERS:
- *
- * RETURNS:
- *
- * NOTES:
- *
- * HISTORY:
- *   1999.08.02  Brian King             Creation
- *
- */
-void DirectDraw_ClearSurfaces( void )
-{
-    DDBLTFX ddbltfx;
-    memset( &ddbltfx, 0, sizeof( ddbltfx ) );
-    ddbltfx.dwFillColor = 0;
-    ddbltfx.dwSize = sizeof( ddbltfx );
-
-    DirectDraw_Blt( secondary_surface, NULL, invalid_surface, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx );
-    if( DirectDrawState.isoverlay )
-       DirectDraw_Blt( overlay_surface, NULL, invalid_surface, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddbltfx );
-}
-
 /*
  * FUNCTION:
  *
@@ -1783,55 +1786,55 @@ static int DirectDraw_BltStub( LPDIRECTDRAWSURFACE7 dstsurf, LPRECT dstrect, LPD
  *
  */
 
-int DirectDraw_Flip( int wait )
+int DirectDraw_Flip(int wait)
 {
     int result = 0;
     HRESULT ddrval = DD_OK;
     DWORD flags = DDFLIP_WAIT;
-    int start = read_processor_time();
     static int skip;
-
-    if( DirectDrawState.flipping == triple_buffer )
-    {
+    frame_time_t start;
+    
+    start = read_processor_time ();
+    if (DirectDrawState.flipping == triple_buffer) {
        if (!currprefs.gfx_afullscreen && !currprefs.gfx_vsync) {
-           ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC);
+           ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC);
        } else if (currprefs.gfx_vsync) {
            if (vblank_skip >= 0) {
                skip++;
                if (vblank_skip > skip) {
-                   ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC);
+                   ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC);
                } else {
                    skip = 0;
-                   ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags );
+                   ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags);
                    idletime += read_processor_time() - start;
                }
            } else {
                if (flipinterval_supported) {
-                   ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags | DDFLIP_INTERVAL2 );
+                   ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags | DDFLIP_INTERVAL2);
                    idletime += read_processor_time() - start;
                } else {
-                   ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags );
+                   ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags);
                    idletime += read_processor_time() - start;
-                   result = DirectDraw_BltFast( tertiary_surface, 0, 0, primary_surface, NULL );
+                   result = DirectDraw_BltFast(tertiary_surface, 0, 0, primary_surface, NULL);
                    start = read_processor_time();
-                   ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags );
+                   ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags);
                    idletime += read_processor_time() - start;
                }
            }
        } else {
-           ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags );
+           ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags);
        }
-    } else if( DirectDrawState.flipping == double_buffer ) {
+    } else if(DirectDrawState.flipping == double_buffer) {
        if (!currprefs.gfx_afullscreen && !currprefs.gfx_vsync) {
-           ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC);
+           ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags | DDFLIP_NOVSYNC);
        } else {
-           ddrval = IDirectDrawSurface7_Flip( DirectDrawState.primary.surface, NULL, flags );
+           ddrval = IDirectDrawSurface7_Flip(DirectDrawState.primary.surface, NULL, flags);
            idletime += read_processor_time() - start;
        }
     } else {
        return 1;
     }
-    if( ddrval == DD_OK ) {
+    if(ddrval == DD_OK) {
         result = 1;
     } else {
        if (ddrval == DDERR_SURFACELOST) {
@@ -1842,8 +1845,9 @@ int DirectDraw_Flip( int wait )
                DirectDraw_Flip (wait);
                recurse--;
            }
-       } else
+       } else {
            write_log("FLIP: DirectDrawSurface_Flip() failed with %s\n", DXError (ddrval));
+       }
     }
     return result;
 }
index 3203b1c3aed5809aa1060760f508b34f60578705..65c3095c30af89df027aaa2b0c26b3f8ea970912 100755 (executable)
@@ -198,7 +198,7 @@ struct DirectDrawSurfaceMapper
     LPDIRECTDRAWPALETTE lpOverlayDDP;
     surface_type_e surface_type;
 };
-HRESULT DirectDraw_CreateOverlaySurface( int width, int height, int bits );
+HRESULT DirectDraw_CreateOverlaySurface(int width, int height, int bits, int type);
 int DirectDraw_Start( GUID *);
 void DirectDraw_Release( void );
 HRESULT DirectDraw_SetCooperativeLevel( HWND window, int want_fullscreen );
index 5683ef0667a56adea2f77929385e638f0960a2b7..a5cfdd7bed55135df60c96187985aad70798fad3 100755 (executable)
@@ -244,7 +244,7 @@ static int handlecd32 (int scancode, int state)
     }
     if (!e)
        return 0;
-    handle_input_event (e, state, 1, 0, NULL);
+    handle_input_event (e, state, 1, 0);
     return 1;
 }
 #endif
@@ -263,7 +263,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
     int code = 0;
     static int swapperdrive = 0;
 
-//    write_log( "keyboard = %d scancode = 0x%02.2x state = %d\n", keyboard, scancode, newstate ); 
+    //write_log( "keyboard = %d scancode = 0x%02.2x state = %d\n", keyboard, scancode, newstate ); 
     if (newstate) {
        switch (scancode)
        {
index db12f248dc53b954e5a895943e3f578640fe7637..16f59a7af73af423f97dacd8d721b1df142fca3e 100755 (executable)
@@ -781,7 +781,7 @@ void hsyncstuff(void)
        if (ahi_on) {
            count++;
            //15625/count freebuffer check
-           if(count > 20) {
+           if(count > ahi_pollrate) {
                ahi_updatesound (1);
                count = 0;
            }
index 0b55d5a00472185451681418428666947a067826..827bc8793c58413da823a4480380a6be72b6565c 100755 (executable)
@@ -473,31 +473,12 @@ static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr
 
 /* list is Amiga address of list, in correct endian format for UAE
 * node is Amiga address of node, in correct endian format for UAE */
-static void AmigaListAddTail (uaecptr list, uaecptr node)
+static void AmigaListAddTail (uaecptr l, uaecptr n)
 {
-    uaecptr amigamemptr = 0;
-    
-    if (get_long (list + 8) == list) {
-       /* Empty list - set it up */
-       put_long (list, node);     /* point the lh_Head to our new node */
-       put_long (list + 4, 0);    /* set the lh_Tail to NULL */
-       put_long (list + 8, node); /* point the lh_TailPred to our new node */
-       
-       /* Adjust the new node - don't rely on it being zeroed out */
-       put_long (node, 0); /* ln_Succ */
-       put_long (node + 4, 0); /* ln_Pred */
-    } else {
-       amigamemptr = get_long (list + 8); /* get the lh_TailPred contents */
-       
-       put_long (list + 8, node); /* point the lh_TailPred to our new node */
-       
-       /* Adjust the previous lh_TailPred node */
-       put_long (amigamemptr, node); /* point the ln_Succ to our new node */
-       
-       /* Adjust the new node - don't rely on it being zeroed out */
-       put_long (node, 0); /* ln_Succ */
-       put_long (node + 4, amigamemptr); /* ln_Pred */
-    }
+    put_long (n + 0, l + 4); // n->ln_Succ = (struct Node *)&l->lh_Tail;
+    put_long (n + 4, get_long (l + 8)); // n->ln_Pred = l->lh_TailPred;
+    put_long (get_long (l + 8) + 0, n); // l->lh_TailPred->ln_Succ = n;
+    put_long (l + 8, n); // l->lh_TailPred = n;
 }
 
 /*
@@ -953,22 +934,28 @@ extern unsigned int new_beamcon0;
 void picasso_refresh ( int call_setpalette )
 {
     struct RenderInfo ri;
+    static int beamcon0_before, p96refresh_was;
    
     if (! picasso_on)
        return;
     {  //for higher P96 mousedraw rate
        /* HACK */
        extern uae_u16 vtotal;
-       if (p96hack_vpos2){
+       if (p96hack_vpos2) {
            vtotal=p96hack_vpos2;
+           beamcon0_before = new_beamcon0;
            new_beamcon0 |= 0x80;
-           p96refresh_active=1;
-       } else new_beamcon0 |= 0x20;
+           p96refresh_active = 1;
+           p96refresh_was = 1;
+       } else {
+           if (p96refresh_was) {
+               new_beamcon0 = beamcon0_before;
+               p96refresh_was = 0;
+           }
+           new_beamcon0 |= 0x20;
+       }
                /* HACK until ntsc timing is fixed.. */
     } //end for higher P96 mousedraw rate
-       
-    
-
     have_done_picasso = 1;
     
     /* Make sure that the first time we show a Picasso video mode, we don't blit any crap.
index 9873e3039cc7598368716bd21a654005e08244b0..7ab0f037ce738e1c80b8b651d7daeb228c595abc 100755 (executable)
 #define IDS_SOUND_4CHANNEL              242
 #define IDS_HF_FS_CUSTOM                243
 #define IDS_SELECTFS                    244
-#define IDB_BITMAP1                     246
 #define IDB_XARCADE                     246
 #define IDS_NUMSG_NEEDEXT2              300
 #define IDS_NUMSG_NOROMKEY              301
 #define IDC_MAPROM                      1609
 #define IDC_AVIOUTPUT_FILETEXT          1610
 #define IDC_INPUTDEVICETEXT             1610
+#define IDC_NOTASKBARBUTTON2            1610
+#define IDC_ALWAYSONTOP                 1610
 #define IDC_AVIOUTPUT_FILE              1611
 #define IDC_INPUTLIST                   1611
 #define IDC_AVIOUTPUT_FPS_STATIC        1612
index 51259dd60b9a7eb0770c2c9fe458514eab87c321..c838ec69ab16ab427aead9786b23a1737e38bbc8 100755 (executable)
@@ -529,7 +529,7 @@ IDD_MISC1 DIALOGEX 0, 0, 300, 223
 STYLE DS_SETFONT | DS_3DLOOK | DS_CONTROL | WS_CHILD
 FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN
-    GROUPBOX        "Advanced:",IDC_STATIC,8,4,285,90
+    GROUPBOX        "Advanced:",IDC_STATIC,8,4,285,103
     CONTROL         "Middle-Mouse-Button --> ALT-TAB",IDC_JULIAN,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,29,21,120,10
     CONTROL         "Show GUI on startup",IDC_SHOWGUI,"Button",
@@ -550,32 +550,34 @@ BEGIN
                     WS_TABSTOP,159,66,115,10
     CONTROL         "Syncronize clock",IDC_CLOCKSYNC,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,159,80,115,10
-    GROUPBOX        "Keyboard LEDs:",IDC_STATIC,7,99,85,73
-    COMBOBOX        IDC_KBLED1,22,112,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
+    GROUPBOX        "Keyboard LEDs:",IDC_STATIC,7,110,85,73
+    COMBOBOX        IDC_KBLED1,22,123,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
                     WS_TABSTOP
-    COMBOBOX        IDC_KBLED2,22,131,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
+    COMBOBOX        IDC_KBLED2,22,142,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
                     WS_TABSTOP
-    COMBOBOX        IDC_KBLED3,22,151,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
+    COMBOBOX        IDC_KBLED3,22,162,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | 
                     WS_TABSTOP
-    GROUPBOX        "Logging:",IDC_STATIC,97,99,195,25
+    GROUPBOX        "Logging:",IDC_STATIC,97,110,195,25
     CONTROL         "Create log file",IDC_CREATELOGFILE,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,107,109,72,10,0,
+                    BS_AUTOCHECKBOX | WS_TABSTOP,107,120,72,10,0,
                     HIDC_CREATELOGFILE
     CONTROL         "Illegal mem accesses",IDC_ILLEGAL,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,189,109,80,10
-    GROUPBOX        "State files:",IDC_STATIC,98,126,195,83
-    PUSHBUTTON      "Load state...",IDC_DOLOADSTATE,105,145,49,14
-    PUSHBUTTON      "Save state...",IDC_DOSAVESTATE,106,171,49,14
+                    BS_AUTOCHECKBOX | WS_TABSTOP,189,120,80,10
+    GROUPBOX        "State files:",IDC_STATIC,98,137,195,83
+    PUSHBUTTON      "Load state...",IDC_DOLOADSTATE,105,156,49,14
+    PUSHBUTTON      "Save state...",IDC_DOSAVESTATE,106,182,49,14
     CONTROL         "Enable state recording",IDC_STATE_CAPTURE,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,188,144,88,10
-    RTEXT           "Recording rate (seconds)",IDC_STATE_RATE_TEXT,157,162,
+                    BS_AUTOCHECKBOX | WS_TABSTOP,188,155,88,10
+    RTEXT           "Recording rate (seconds)",IDC_STATE_RATE_TEXT,157,173,
                     86,10,SS_CENTERIMAGE | WS_TABSTOP
-    COMBOBOX        IDC_STATE_RATE,248,160,38,65,CBS_DROPDOWN | WS_VSCROLL | 
+    COMBOBOX        IDC_STATE_RATE,248,171,38,65,CBS_DROPDOWN | WS_VSCROLL | 
                     WS_TABSTOP
     RTEXT           "Recording buffer (MB)",IDC_STATE_BUFFERSIZE_TEXT,157,
-                    182,83,10,SS_CENTERIMAGE | WS_TABSTOP
-    COMBOBOX        IDC_STATE_BUFFERSIZE,248,180,38,65,CBS_DROPDOWN | 
+                    193,83,10,SS_CENTERIMAGE | WS_TABSTOP
+    COMBOBOX        IDC_STATE_BUFFERSIZE,248,191,38,65,CBS_DROPDOWN | 
                     WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | 
+                    WS_TABSTOP,29,94,117,10
 END
 
 IDD_HARDFILE DIALOGEX 0, 0, 299, 212
index 86deb208d72a0fb8551214ede85bf97a90a2c1e2..7e4190a88c14ca902d6d578262100f0c118796a5 100755 (executable)
@@ -1247,12 +1247,23 @@ int WIN32_InitHtmlHelp( void )
     return result;
 }
 
+typedef LANGID (CALLBACK* PGETUSERDEFAULTUILANGUAGE)(void);
+static PGETUSERDEFAULTUILANGUAGE pGetUserDefaultUILanguage;
+
 static HMODULE LoadGUI( void )
 {
     HMODULE result = NULL;
     LPCTSTR dllname = NULL;
-    LANGID language = GetUserDefaultLangID() & 0x3FF; // low 9-bits form the primary-language ID
     char dllbuf[MAX_DPATH];
+    LANGID language;
+
+    /* new user-specific Windows ME/2K/XP method to get UI language */
+    pGetUserDefaultUILanguage = (PGETUSERDEFAULTUILANGUAGE)GetProcAddress(
+       GetModuleHandle("kernel32.dll"), "GetUserDefaultUILanguage");
+    language = GetUserDefaultLangID();
+    if (pGetUserDefaultUILanguage)
+       language = pGetUserDefaultUILanguage();
+    language &= 0x3ff; // low 9-bits form the primary-language ID
 
     switch( language )
     {
@@ -1632,10 +1643,11 @@ void target_default_options (struct uae_prefs *p, int type)
        p->win32_no_overlay = 0;
        p->win32_ctrl_F11_is_quit = 0;
        p->win32_soundcard = 0;
-       p->win32_active_priority = 0;
+       p->win32_active_priority = 1;
        p->win32_inactive_priority = 2;
        p->win32_iconified_priority = 3;
        p->win32_notaskbarbutton = 0;
+       p->win32_alwaysontop = 0;
     }
     if (type == 1 || type == 0) {
         p->win32_midioutdev = -2;
@@ -1667,6 +1679,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
     cfgfile_write (f, "win32.soundcard=%d\n", p->win32_soundcard );
     cfgfile_write (f, "win32.cpu_idle=%d\n", p->cpu_idle);
     cfgfile_write (f, "win32.notaskbarbutton=%s\n", p->win32_notaskbarbutton ? "true" : "false");
+    cfgfile_write (f, "win32.always_on_top=%s\n", p->win32_alwaysontop ? "true" : "false");
 }
 
 static int fetchpri (int pri, int defpri)
@@ -1709,14 +1722,15 @@ int target_parse_option (struct uae_prefs *p, char *option, char *value)
            || cfgfile_string (option, value, "serial_port", &p->sername[0], 256)
            || cfgfile_string (option, value, "parallel_port", &p->prtname[0], 256)
            || cfgfile_yesno  (option, value, "notaskbarbutton", &p->win32_notaskbarbutton)
+           || cfgfile_yesno  (option, value, "always_on_top", &p->win32_alwaysontop)
            || cfgfile_intval  (option, value, "cpu_idle", &p->cpu_idle, 1));
 
     if (cfgfile_intval (option, value, "active_priority", &v, 1)) {
-       p->win32_active_priority = fetchpri (v, 0);
+       p->win32_active_priority = fetchpri (v, 1);
        return 1;
     }
     if (cfgfile_intval (option, value, "activepriority", &v, 1)) {
-       p->win32_active_priority = fetchpri (v, 0);
+       p->win32_active_priority = fetchpri (v, 1);
        return 1;
     }
     if (cfgfile_intval (option, value, "inactive_priority", &v, 1)) {
index 6d25d4805e19aa09384981e65bd03c1bbf97ed17..c48a2d2b31384787602ce2adc4501df8a3e67b1c 100755 (executable)
@@ -22,7 +22,7 @@ extern int manual_palette_refresh_needed;
 extern int mouseactive, focus;
 extern int ignore_messages_all;
 #define WINUAEBETA 1
-#define WINUAEBETASTR " Beta 5"
+#define WINUAEBETASTR " Beta 6"
 
 extern void my_kbd_handler (int, int, int);
 extern void clearallkeys(void);
index 852a3dbb2623ec17a6b35ffd735a996d2738039d..f4785daa4c23aa76d1ec3996e13dfd11314581e0 100755 (executable)
@@ -261,7 +261,7 @@ uae_u16 picasso96_pixel_format = RGBFF_CHUNKY;
 /* For the DX_Invalidate() and gfx_unlock_picasso() functions */
 static int p96_double_buffer_first, p96_double_buffer_last, p96_double_buffer_needs_flushing = 0;
 
-static char scrlinebuf[4096];  /* this is too large, but let's rather play on the safe side here */
+static char scrlinebuf[4096 * 4]; /* this is too large, but let's rather play on the safe side here */
 
 static int rgbformat_bits (RGBFTYPE t)
 {
@@ -364,7 +364,7 @@ static int set_ddraw (void)
            goto oops;
        }
        if (DirectDraw_GetPrimaryBitCount() != (unsigned)bits && overlay) {
-           ddrval = DirectDraw_CreateOverlaySurface (width, height, bits);
+           ddrval = DirectDraw_CreateOverlaySurface (width, height, bits, 0);
            if( ddrval != DD_OK )
            {
                write_log( "set_ddraw: Couldn't CreateOverlaySurface(%d,%d,%d) because %s.\n", width, height, bits, DXError( ddrval ) );
@@ -739,20 +739,35 @@ int WIN32GFX_AdjustScreenmode( uae_u32 *pwidth, uae_u32 *pheight, uae_u32 *ppixb
 // the front and back buffers.  Additionally, because the emulation is not always drawing
 // complete frames, we also need to update the back-buffer with the new contents we just
 // flipped to.  Thus, after our flip, we blit.
-static int DX_Flip( void )
+static int DX_Flip(void)
 {
     int result = 0;
+#if 0
+    static frame_time_t end;
+    frame_time_t start, used;
 
+    start = read_processor_time();
+    used = start - end;
+    if (used > 0 && used < vsynctime * 2) {
+        int pct = used * 100 / vsynctime;
+       write_log ("%d\n", pct);
+       if (pct < 95)
+           sleep_millis_busy (2 + (95 - pct) / 10);
+    }
+#endif
     result = DirectDraw_Flip(0);
     if( result )
     {
-//     result = DirectDraw_BltFast( primary_surface, 0, 0, secondary_surface, NULL );
-//     result = DirectDraw_BltFast( primary_surface, 0, 0, tertiary_surface, NULL );
-//     result = DirectDraw_BltFast( secondary_surface, 0, 0, primary_surface, NULL );
-//     result = DirectDraw_BltFast( secondary_surface, 0, 0, tertiary_surface, NULL );
-       result = DirectDraw_BltFast( tertiary_surface, 0, 0, primary_surface, NULL );
-//     result = DirectDraw_BltFast( tertiary_surface, 0, 0, secondary_surface, NULL );
+//     result = DirectDraw_BltFast(primary_surface, 0, 0, secondary_surface, NULL);
+//     result = DirectDraw_BltFast(primary_surface, 0, 0, tertiary_surface, NULL);
+//     result = DirectDraw_BltFast(secondary_surface, 0, 0, primary_surface, NULL);
+//     result = DirectDraw_BltFast(secondary_surface, 0, 0, tertiary_surface, NULL);
+       result = DirectDraw_BltFast(tertiary_surface, 0, 0, primary_surface, NULL);
+//     result = DirectDraw_BltFast(tertiary_surface, 0, 0, secondary_surface, NULL);
     }
+#if 0
+    end = read_processor_time();
+#endif
     return result;
 }
 
@@ -793,21 +808,12 @@ void flush_screen (int a, int b)
 
 static uae_u8 *ddraw_dolock (void)
 {
-    static char *surface = NULL, *oldsurface;
-
-    if( !DirectDraw_SurfaceLock( lockable_surface ) )
+    if (!DirectDraw_SurfaceLock(lockable_surface))
        return 0;
-
-    surface = DirectDraw_GetSurfacePointer();
-    oldsurface = gfxvidinfo.bufmem;
-    gfxvidinfo.bufmem = surface;
-    if (surface != oldsurface && !screen_is_picasso) 
-    {
-       init_row_map ();
-    }
-
+    gfxvidinfo.bufmem = DirectDraw_GetSurfacePointer();
+    init_row_map ();
     clear_inhibit_frame (IHF_WINDOWHIDDEN);
-    return surface;
+    return gfxvidinfo.bufmem;
 }
 
 int lockscr (void)
@@ -981,12 +987,13 @@ int check_prefs_changed_gfx (void)
     c |= currprefs.gfx_afullscreen != changed_prefs.gfx_afullscreen ? 2 : 0;
     c |= currprefs.gfx_pfullscreen != changed_prefs.gfx_pfullscreen ? 2 : 0;
     c |= currprefs.gfx_vsync != changed_prefs.gfx_vsync ? 2 : 0;
-    c |= currprefs.gfx_refreshrate != changed_prefs.gfx_refreshrate? 1 : 0;
-    c |= currprefs.gfx_filter != changed_prefs.gfx_filter? 1 : 0;
-    c |= currprefs.gfx_filter_filtermode != changed_prefs.gfx_filter_filtermode? 1 : 0;
-    c |= currprefs.gfx_lores != changed_prefs.gfx_lores? 1 : 0;
-    c |= currprefs.gfx_linedbl != changed_prefs.gfx_linedbl? 1 : 0;
-    c |= currprefs.gfx_display != changed_prefs.gfx_display? 1 : 0;
+    c |= currprefs.gfx_refreshrate != changed_prefs.gfx_refreshrate ? 1 : 0;
+    c |= currprefs.gfx_filter != changed_prefs.gfx_filter ? 1 : 0;
+    c |= currprefs.gfx_filter_filtermode != changed_prefs.gfx_filter_filtermode ? 1 : 0;
+    c |= currprefs.gfx_lores != changed_prefs.gfx_lores ? 1 : 0;
+    c |= currprefs.gfx_linedbl != changed_prefs.gfx_linedbl ? 1 : 0;
+    c |= currprefs.gfx_display != changed_prefs.gfx_display ? 1 : 0;
+    c |= currprefs.win32_alwaysontop != changed_prefs.win32_alwaysontop ? 1 : 0;
     if (display_change_requested || c) 
     {
        if (!display_change_requested)
@@ -1008,6 +1015,7 @@ int check_prefs_changed_gfx (void)
        currprefs.gfx_lores = changed_prefs.gfx_lores;
        currprefs.gfx_linedbl = changed_prefs.gfx_linedbl;
        currprefs.gfx_display = changed_prefs.gfx_display;
+       currprefs.win32_alwaysontop = changed_prefs.win32_alwaysontop;
         inputdevice_unacquire ();
        close_windows ();
        graphics_init ();
@@ -1731,7 +1739,7 @@ static int create_windows (void)
            break;
        }
 
-        hMainWnd = CreateWindowEx ((picasso_on ? WS_EX_ACCEPTFILES : WS_EX_ACCEPTFILES) | exstyle,
+        hMainWnd = CreateWindowEx (WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
                                        "PCsuxRox", "WinUAE",
                                       NORMAL_WINDOW_STYLE  | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                                       rc.left, rc.top,
@@ -1749,7 +1757,7 @@ static int create_windows (void)
     else
        hMainWnd = NULL;
 
-    hAmigaWnd = CreateWindowEx (fs ? WS_EX_ACCEPTFILES | WS_EX_TOPMOST : WS_EX_ACCEPTFILES | exstyle,
+    hAmigaWnd = CreateWindowEx (fs ? WS_EX_ACCEPTFILES | WS_EX_TOPMOST : WS_EX_ACCEPTFILES | exstyle | (currprefs.win32_alwaysontop ? WS_EX_TOPMOST : 0),
                                "AmigaPowah", "WinUAE",
                                WS_CLIPCHILDREN | WS_CLIPSIBLINGS | (hMainWnd ? WS_VISIBLE | WS_CHILD : WS_VISIBLE | WS_POPUP),
                                hMainWnd ? 2 : CW_USEDEFAULT, hMainWnd ? 2 : CW_USEDEFAULT,
index ff6229aafb071f42b6e63360499402a976a05351..e7e31904ae3fd49ce1638e18b93950882a155dd8 100755 (executable)
@@ -4221,6 +4221,7 @@ static void values_to_miscdlg (HWND hDlg)
     CheckDlgButton (hDlg, IDC_SHOWLEDS, workprefs.leds_on_screen);
     CheckDlgButton (hDlg, IDC_SCSIDEVICE, workprefs.scsi);
     CheckDlgButton (hDlg, IDC_NOTASKBARBUTTON, workprefs.win32_notaskbarbutton);
+    CheckDlgButton (hDlg, IDC_ALWAYSONTOP, workprefs.win32_alwaysontop);
     CheckDlgButton (hDlg, IDC_ASPI, workprefs.win32_aspi);
     CheckDlgButton (hDlg, IDC_CLOCKSYNC, workprefs.tod_hack);
     CheckDlgButton (hDlg, IDC_STATE_CAPTURE, workprefs.statecapture);
@@ -4369,6 +4370,9 @@ static BOOL MiscDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
        case IDC_NOTASKBARBUTTON:
            workprefs.win32_notaskbarbutton = IsDlgButtonChecked (hDlg, IDC_NOTASKBARBUTTON);
            break;
+       case IDC_ALWAYSONTOP:
+           workprefs.win32_alwaysontop = IsDlgButtonChecked (hDlg, IDC_ALWAYSONTOP);
+           break;
        }
        return TRUE;
     }
@@ -5873,10 +5877,10 @@ static void deletesaveimage (HWND hDlg, int num)
 static void diskselect (HWND hDlg, WPARAM wParam, struct uae_prefs *p, int drv)
 {
     MultiDiskSelection (hDlg, wParam, 0, &workprefs, NULL);
-    disk_insert (drv, p->df[0]);
-    disk_insert (drv, p->df[1]);
-    disk_insert (drv, p->df[2]);
-    disk_insert (drv, p->df[3]);
+    disk_insert (0, p->df[0]);
+    disk_insert (1, p->df[1]);
+    disk_insert (2, p->df[2]);
+    disk_insert (3, p->df[3]);
     addfloppytype (hDlg, drv);
 }
 
index 84ef6661fc4573728b78f036642faaf0a096dbb1..7ffa898c3fc2e3ba055994882ae29bfb9203b81a 100755 (executable)
@@ -656,19 +656,25 @@ void savestate_quick (int slot, int save)
        i = len - 1;
        while (i >= 0 && savestate_fname[i] != '.')
            i--;
-       if (i <= 0)
+       if (i <= 0) {
+           write_log ("savestate name skipped '%s'\n", savestate_fname);
            return;
+       }
     }
     strcpy (savestate_fname + i, ".uss");
     if (slot > 0)
        sprintf (savestate_fname + i, "_%d.uss", slot);
     if (save) {
+       write_log ("saving '%s'\n", savestate_fname);
        savestate_docompress = 1;
        save_state (savestate_fname, "");
     } else {
-       if (!zfile_exists (savestate_fname))
+       if (!zfile_exists (savestate_fname)) {
+           write_log ("staterestore, file '%s' not found\n", savestate_fname);
            return;
+       }
        savestate_state = STATE_DORESTORE;
+       write_log ("staterestore starting '%s'\n", savestate_fname);
     }
 }