]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
2100b18
authorToni Wilen <twilen@winuae.net>
Sat, 20 Mar 2010 15:00:09 +0000 (17:00 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 20 Mar 2010 15:00:09 +0000 (17:00 +0200)
17 files changed:
disk.cpp
drawing.cpp
include/options.h
include/xwin.h
inputdevice.cpp
od-win32/direct3d.cpp
od-win32/direct3d.h
od-win32/picasso96_win.cpp
od-win32/picasso96_win.h
od-win32/resources/resource
od-win32/resources/winuae.rc
od-win32/win32.cpp
od-win32/win32.h
od-win32/win32_scaler.cpp
od-win32/win32gfx.cpp
od-win32/win32gui.cpp
sampler.cpp

index 895ad688e41b111259e683d133555bac9cedb3bc..0f75a9cd8265c7fc7be2706947018331d88863d2 100644 (file)
--- a/disk.cpp
+++ b/disk.cpp
@@ -112,7 +112,7 @@ typedef struct {
        uae_u16 len;
        uae_u32 offs;
        int bitlen, track;
-       unsigned int sync;
+       uae_u16 sync;
        image_tracktype type;
        int revolutions;
 } trackid;
@@ -871,7 +871,7 @@ static int diskfile_iswriteprotect (const TCHAR *fname, int *needwritefile, driv
 
 static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR *fname)
 {
-       uae_char buffer[2 + 2 + 4 + 4];
+       uae_u8 buffer[2 + 2 + 4 + 4];
        trackid *tid;
        int num_tracks, size;
        int canauto;
@@ -918,7 +918,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
        _tcscpy (drv->newname, fname);
        gui_filename (dnum, fname);
 
-       memset (buffer, 0, sizeof (buffer));
+       memset (buffer, 0, sizeof buffer);
        size = 0;
        if (drv->diskfile) {
                zfile_fread (buffer, sizeof (char), 8, drv->diskfile);
@@ -935,7 +935,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
                drv->ddhd = 1;
 
 #ifdef CAPS
-       } else if (strncmp (buffer, "CAPS", 4) == 0) {
+       } else if (strncmp ((char*)buffer, "CAPS", 4) == 0) {
 
                drv->wrprot = 1;
                if (!caps_loadimage (drv->diskfile, drv - floppy, &num_tracks)) {
@@ -954,7 +954,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
                drv->num_secs = fdi2raw_get_num_sector (drv->fdi);
                drv->filetype = ADF_FDI;
 #endif
-       } else if (strncmp (buffer, "UAE-1ADF", 8) == 0) {
+       } else if (strncmp ((char*)buffer, "UAE-1ADF", 8) == 0) {
 
                read_header_ext2 (drv->diskfile, drv->trackdata, &drv->num_tracks, &drv->ddhd);
                drv->filetype = ADF_EXT2;
@@ -962,7 +962,7 @@ static int drive_insert (drive * drv, struct uae_prefs *p, int dnum, const TCHAR
                if (drv->ddhd > 1)
                        drv->num_secs = 22;
 
-       } else if (strncmp (buffer, "UAE--ADF", 8) == 0) {
+       } else if (strncmp ((char*)buffer, "UAE--ADF", 8) == 0) {
                int offs = 160 * 4 + 8;
                int i;
 
index 4b860ee2a51abaeebd7e172f1627979fb324d98f..124155fbd39adfcae7e2440e3f62ec4a12bd2a2d 100644 (file)
@@ -2740,7 +2740,7 @@ void finish_drawing_frame (void)
 {
        int i;
 
-       if (! lockscr ()) {
+       if (! lockscr (false)) {
                notice_screen_contents_lost ();
                return;
        }
index 4954b4ab35eeda5143bc6522bea5ae2c27bf256f..9eb35415787f6a410eab5dfdfa62b8cfee89ecb2 100644 (file)
@@ -327,6 +327,7 @@ struct uae_prefs {
     int win32_notaskbarbutton;
     int win32_alwaysontop;
     int win32_powersavedisabled;
+       int win32_minimize_inactive;
 
     int win32_active_priority;
     int win32_inactive_priority;
index 3fee419f44b2814328829c555bdb62130bd23ccb..6f780d7d3ddc88fc9fd0aa938733f4e814e1f394 100644 (file)
@@ -35,7 +35,7 @@ extern void flush_block (int, int);
 extern void flush_screen (int, int);
 extern void flush_clear_screen (void);
 
-extern int lockscr (void);
+extern int lockscr (int);
 extern void unlockscr (void);
 
 extern int debuggable (void);
index 4f13f66b3ac945719022b050bd906d99e082487a..d9bc0198d7ccfea1dfd65125da033a9d71e60b78 100644 (file)
@@ -2251,7 +2251,7 @@ void inputdevice_handle_inputcode (void)
                toggle_inhibit_frame (IHF_SCROLLLOCK);
                break;
        case AKS_STATEREWIND:
-               savestate_dorewind(1);
+               savestate_dorewind (1);
                break;
        case AKS_VOLDOWN:
                sound_volume (-1);
index cc07b44c8b832fc82ef0165c6e8822432343dd82..d93aaa01b295149faf14439b2818d5301c9b6cd2 100644 (file)
@@ -45,7 +45,7 @@ static IDirect3DVertexBuffer9 *vertexBuffer;
 static ID3DXSprite *sprite;
 static HWND d3dhwnd;
 static int devicelost;
-static int locked;
+static int locked, fulllocked;
 static int cursor_offset_x, cursor_offset_y;
 static float maskmult_x, maskmult_y;
 
@@ -804,13 +804,14 @@ static void updateleds (void)
                }
                done = 1;
        }
-       hr = ledtexture->LockRect (0, &locked, NULL, 0);
+       hr = ledtexture->LockRect (0, &locked, NULL, D3DLOCK_DISCARD);
        if (FAILED (hr)) {
                write_log (L"%d: SL LockRect failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
                return;
        }
        for (y = 0; y < TD_TOTAL_HEIGHT; y++) {
                uae_u8 *buf = (uae_u8*)locked.pBits + y * locked.Pitch;
+               memset (buf, 0, ledwidth * 4);
                draw_status_line_single (buf, 32 / 8, y, ledwidth, rc, gc, bc, a);
        }
        ledtexture->UnlockRect (0);
@@ -1834,10 +1835,13 @@ void D3D_unlocktexture (void)
        if (locked)
                hr = texture->UnlockRect (0);
        locked = 0;
+       fulllocked = 0;
 }
 
 void D3D_flushtexture (int miny, int maxy)
 {
+       if (fulllocked)
+               return;
        if (miny >= 0 && maxy >= 0) {
                RECT r;
                maxy++;
@@ -1854,7 +1858,7 @@ void D3D_flushtexture (int miny, int maxy)
        }
 }
 
-uae_u8 *D3D_locktexture (int *pitch)
+uae_u8 *D3D_locktexture (int *pitch, int fullupdate)
 {
        D3DLOCKED_RECT lock;
        HRESULT hr;
@@ -1866,7 +1870,7 @@ uae_u8 *D3D_locktexture (int *pitch)
 
        lock.pBits = NULL;
        lock.Pitch = 0;
-       hr = texture->LockRect (0, &lock, NULL, D3DLOCK_NO_DIRTY_UPDATE);
+       hr = texture->LockRect (0, &lock, NULL, fullupdate ? D3DLOCK_DISCARD : D3DLOCK_NO_DIRTY_UPDATE);
        if (FAILED (hr)) {
                write_log (L"%s: LockRect failed: %s\n", D3DHEAD, D3D_ErrorString (hr));
                return NULL;
@@ -1877,6 +1881,7 @@ uae_u8 *D3D_locktexture (int *pitch)
                return NULL;
        }
        locked = 1;
+       fulllocked = fullupdate;
        *pitch = lock.Pitch;
        return (uae_u8*)lock.pBits;
 }
index ce55ceb5d923962bd12c345cb45bce781856b00e..de04171414de49a0e37c9251bbd179e824d79ce4 100644 (file)
@@ -4,7 +4,7 @@ extern const TCHAR *D3D_init (HWND ahwnd, int w_w, int w_h, int t_w, int t_h, in
 extern void D3D_getpixelformat (int depth,int *rb, int *bb, int *gb, int *rs, int *bs, int *gs, int *ab, int *ar, int *a);
 extern void D3D_refresh (void);
 extern void D3D_flip (void);
-extern uae_u8 *D3D_locktexture(int*);
+extern uae_u8 *D3D_locktexture(int*,int);
 extern void D3D_unlocktexture(void);
 extern void D3D_flushtexture (int miny, int maxy);
 extern void D3D_guimode (int guion);
index 67df02eb516839dd1ca4570b0171a30ac413a96f..b9b06775267090523d030a14473f00a9f5a4cf24 100644 (file)
@@ -3741,12 +3741,14 @@ static void copyallinvert (uae_u8 *src, uae_u8 *dst)
                        src += picasso96_state.BytesPerRow;
                }
        } else {
+               uae_u8 *src2 = src;
                for (y = 0; y < picasso96_state.Height; y++) {
                        for (x = 0; x < w; x++)
-                               src[x] ^= 0xff;
+                               src2[x] ^= 0xff;
                        copyrow (src, dst, 0, y, picasso96_state.Width);
                        for (x = 0; x < w; x++)
-                               src[x] ^= 0xff;
+                               src2[x] ^= 0xff;
+                       src2 += picasso96_state.BytesPerRow;
                }
        }
 }
@@ -3821,7 +3823,7 @@ static int flushpixels (void)
 
                dofull = gwwcnt >= ((src_end - src_start) / gwwpagesize) * 80 / 100;
 
-               dst = gfx_lock_picasso ();
+               dst = gfx_lock_picasso (dofull);
                if (dst == NULL)
                        break;
                lock = 1;
@@ -3880,7 +3882,7 @@ static int flushpixels (void)
 
        if (!currprefs.gfx_api && (currprefs.leds_on_screen & STATUSLINE_RTG)) {
                if (dst == NULL) {
-                       dst = gfx_lock_picasso ();
+                       dst = gfx_lock_picasso (false);
                        lock = 1;
                }
                if (dst) {
index 71ce7e54795fd29b7a4ab02ba93d0a862474f2b4..09c3f616e3b0d92acd107a409a54d0f7f613eb07 100644 (file)
@@ -574,7 +574,7 @@ extern void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 d, RGBFTYPE
 extern void gfx_set_picasso_colors (RGBFTYPE rgbfmt);
 extern void gfx_set_picasso_baseaddr (uaecptr);
 extern void gfx_set_picasso_state (int on);
-extern uae_u8 *gfx_lock_picasso (void);
+extern uae_u8 *gfx_lock_picasso (int);
 extern void gfx_unlock_picasso (void);
 extern void picasso_clip_mouse (int *, int *);
 extern int createwindowscursor (uaecptr src, int w, int h, int hiressprite, int doubledsprite, int chipset);
index e30fd9a245c5d5e16342e72ec878eb689afe1339..534fffdd5439fc5484d839bac748167b34cad851 100644 (file)
 #define IDC_PORT3_JOYS                  1032
 #define IDC_PARALLEL                    1033
 #define IDC_JULIAN                      1040
+#define IDC_JULIAN2                     1041
+#define IDC_FOCUSMINIMIZE               1041
 #define IDC_FASTTEXT                    1043
 #define IDC_FASTRAM                     1044
 #define IDC_CHIPRAM                     1045
 #define IDC_RTG_VBLANKRATE              1793
 #define IDC_DF0WPTEXTQ                  1793
 #define IDC_DF1WPTEXTQ                  1794
-#define IDC_INPUTENABLEGAMEPORTS        1796
 #define ID__FLOPPYDRIVES                40004
 #define ID_FLOPPYDRIVES_DF0             40005
 #define ID_ST_CONFIGURATION             40010
index 5b5425826a5fa5ad9ed55e58576448eb75a6c0f5..fc6074497bb561c851648a0883541df9e24f365b 100644 (file)
@@ -460,10 +460,10 @@ FONT 8, "MS Sans Serif", 0, 0, 0x1
 BEGIN\r
     GROUPBOX        "Miscellaneous Options",IDC_STATIC,8,2,290,136\r
     CONTROL         "Untrap = middle button",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,19,110,10\r
-    CONTROL         "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,31,109,10\r
+    CONTROL         "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,43,109,10\r
     CONTROL         "Native On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,80,109,10\r
-    CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,56,109,10\r
-    CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,43,110,10\r
+    CONTROL         "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,67,109,10\r
+    CONTROL         "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,55,110,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
@@ -479,21 +479,22 @@ BEGIN
     COMBOBOX        IDC_STATE_RATE,248,197,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP\r
     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,19,69,110,10\r
+    CONTROL         "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,79,110,10\r
     CONTROL         "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10\r
     COMBOBOX        IDC_SCSIMODE,213,30,80,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     COMBOBOX        IDC_LANGUAGE,153,117,122,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
     GROUPBOX        "Language",IDC_STATIC,138,107,154,27\r
-    CONTROL         "Disable screensaver",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,82,109,10\r
+    CONTROL         "Disable screensaver",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,91,109,10\r
     COMBOBOX        IDC_DD_SURFACETYPE,213,63,79,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
     RTEXT           "DirectDraw display buffer:",IDC_STATIC,195,50,92,10,SS_CENTERIMAGE\r
     RTEXT           "SCSI and CD/DVD access method:",IDC_STATIC,151,12,126,10,SS_CENTERIMAGE\r
-    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,95,111,10\r
+    CONTROL         "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,103,111,10\r
     CONTROL         "Faster RTG [] Enables less accurate custom chipset emulation mode when Picasso96 is enabled.",IDC_FASTERRTG,\r
-                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,108,100,10\r
+                    "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,115,100,10\r
     CONTROL         "RTG On-screen LEDs",IDC_SHOWLEDSRTG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,93,109,10\r
     LTEXT           "Graphics API:",IDC_STATIC,136,49,62,10,SS_CENTERIMAGE\r
     COMBOBOX        IDC_DXMODE,138,62,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP\r
+    CONTROL         "Minimize when focus is lost",IDC_FOCUSMINIMIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,31,110,10\r
 END\r
 \r
 IDD_HARDFILE DIALOGEX 0, 0, 299, 249\r
@@ -1167,6 +1168,10 @@ BEGIN
         BOTTOMMARGIN, 237\r
     END\r
 \r
+    IDD_MISC2, DIALOG\r
+    BEGIN\r
+    END\r
+\r
     IDD_DISK, DIALOG\r
     BEGIN\r
     END\r
index 360de0c787ed77234d936f4bbdff980c50991da7..bed40be9faffea337411ea22dc3c7ad5d73dbaba 100644 (file)
@@ -658,7 +658,7 @@ static void winuae_active (HWND hWnd, int minimized)
        inputdevice_acquire (FALSE);
        wait_keyrelease ();
        inputdevice_acquire (TRUE);
-       if (isfullscreen() > 0 && !gui_active)
+       if (isfullscreen() != 0 && !gui_active)
                setmouseactive (1);
 #ifdef LOGITECHLCD
        if (!minimized)
@@ -815,6 +815,9 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                dx_check ();
                break;
        case WM_ACTIVATEAPP:
+               if (!wParam && isfullscreen () <= 0 && currprefs.win32_minimize_inactive)
+                       minimizewindow ();
+
 #ifdef RETROPLATFORM
                rp_activate (wParam, lParam);
 #endif
@@ -860,6 +863,8 @@ static LRESULT CALLBACK AmigaWindowProc (HWND hWnd, UINT message, WPARAM wParam,
                        if (isfullscreen () > 0)
                                minimizewindow ();
 #endif
+                       if (isfullscreen () < 0 && currprefs.win32_minimize_inactive)
+                               minimizewindow ();
                        if (mouseactive)
                                setmouseactive (0);
                } else {
@@ -2233,7 +2238,7 @@ static void __cdecl wparse_cmdline (
                }
 #endif  /* _MBCS */
 
-       } while ( (c != NULCHAR && (inquote || (c !=SPACECHAR && c != TABCHAR))) );
+       } while ( (c != NULCHAR && (inquote || (c != SPACECHAR && c != TABCHAR))) );
 
        if ( c == NULCHAR ) {
                p--;
@@ -2361,9 +2366,15 @@ static TCHAR **parseargstring (TCHAR *s)
        numa++;
        p = (TCHAR**)xcalloc (uae_u8, numa * sizeof (TCHAR*) + numc * sizeof (TCHAR));
        wparse_cmdline (s, (wchar_t **)p, (wchar_t *)(((char *)p) + numa * sizeof(wchar_t *)), &numa, &numc);
-       if (numa > MAX_ARGUMENTS)
+       if (numa > MAX_ARGUMENTS) {
                p[MAX_ARGUMENTS] = NULL;
-       return p;
+               numa = MAX_ARGUMENTS;
+       }
+       TCHAR **dstp = xcalloc (TCHAR*, MAX_ARGUMENTS + 1);
+       for (int i = 0; p[i]; i++)
+               dstp[i] = my_strdup (p[i]);
+       xfree (p);
+       return dstp;
 }
 
 
@@ -2428,6 +2439,8 @@ static void shellexecute (TCHAR *command)
                xfree (exec);
                xfree (cmd);
        }
+       for (i = 0; arg && arg[i]; i++)
+               xfree (arg[i]);
        xfree (arg);
 }
 
@@ -2459,6 +2472,7 @@ void target_default_options (struct uae_prefs *p, int type)
                p->win32_ctrl_F11_is_quit = 0;
                p->win32_soundcard = 0;
                p->win32_soundexclusive = 0;
+               p->win32_minimize_inactive = 0;
                p->win32_active_priority = 1;
                p->win32_inactive_priority = 2;
                p->win32_iconified_priority = 3;
@@ -2520,6 +2534,7 @@ void target_save_options (struct zfile *f, struct uae_prefs *p)
        cfgfile_target_dwrite (f, L"iconified_priority", L"%d", priorities[p->win32_iconified_priority].value);
        cfgfile_target_dwrite_bool (f, L"iconified_nosound", p->win32_iconified_nosound);
        cfgfile_target_dwrite_bool (f, L"iconified_pause", p->win32_iconified_pause);
+       cfgfile_target_dwrite_bool (f, L"inactive_iconify", p->win32_minimize_inactive);
 
        cfgfile_target_dwrite_bool (f, L"ctrl_f11_is_quit", p->win32_ctrl_F11_is_quit);
        cfgfile_target_dwrite (f, L"midiout_device", L"%d", p->win32_midioutdev);
@@ -2703,6 +2718,9 @@ int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                p->win32_iconified_priority = fetchpri (v, 2);
                return 1;
        }
+       
+       if (cfgfile_yesno (option, value, L"inactive_iconify", &p->win32_minimize_inactive))
+               return 1;
 
        if (cfgfile_string (option, value, L"serial_port", &p->sername[0], 256)) {
                sernametodev(p->sername);
@@ -4337,6 +4355,9 @@ static int PASCAL WinMain2 (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR
                        xfree (argv2[i]);
                xfree (argv2);
        }
+       for (i = 0; argv3 && argv3[i]; i++)
+               xfree (argv3[i]);
+       xfree (argv3);
        return FALSE;
 }
 
index 8a052a7612a20ec6fc68584264ef2e1724f8bdb1..42eb4bd2d5fb7d02a3be6e0f041a947be748ab6b 100644 (file)
@@ -18,8 +18,8 @@
 #define WINUAEPUBLICBETA 1
 #define LANG_DLL 1
 
-#define WINUAEBETA L"17"
-#define WINUAEDATE MAKEBD(2010, 3, 14)
+#define WINUAEBETA L"18"
+#define WINUAEDATE MAKEBD(2010, 3, 20)
 #define WINUAEEXTRA L""
 #define WINUAEREV L""
 
index 7489433195b00a23befd611c77bf270e1c09d54f..83527f6316107b17a9bf1f3a7a83953d0e6b6ddd 100644 (file)
@@ -584,7 +584,7 @@ void S2X_render (void)
        bufmem_ptr = sptr;
 
        if (d3d) {
-               surfstart = D3D_locktexture (&pitch);
+               surfstart = D3D_locktexture (&pitch, true);
                if (surfstart == NULL)
                        return;
        } else {
index 8c32a8e5a76aa60c6994b040cdf24a2112e45af9..ac8f182c07bd0d8089b94d3e6f74c9c6b54ef153 100644 (file)
@@ -789,6 +789,8 @@ static void flushit (int lineno)
 {
        if (!currprefs.gfx_api)
                return;
+       if (currentmode->flags & DM_SWSCALE)
+               return;
        if (flushymin > lineno) {
                if (flushymin - lineno > FLUSH_DIFF && flushymax != 0) {
                        D3D_flushtexture (flushymin, flushymax);
@@ -851,7 +853,7 @@ static uae_u8 *ddraw_dolock (void)
        return gfxvidinfo.bufmem;
 }
 
-int lockscr (void)
+int lockscr (int fullupdate)
 {
        int ret = 0;
        if (!isscreen ())
@@ -861,11 +863,11 @@ int lockscr (void)
        ret = 1;
        if (currentmode->flags & DM_D3D) {
 #ifdef D3D
-               if ((currentmode->flags & DM_SWSCALE) && usedfilter->type != UAE_FILTER_NULL) {
+               if (currentmode->flags & DM_SWSCALE) {
                        ret = 1;
                } else {
                        ret = 0;
-                       gfxvidinfo.bufmem = D3D_locktexture (&gfxvidinfo.rowbytes);
+                       gfxvidinfo.bufmem = D3D_locktexture (&gfxvidinfo.rowbytes, fullupdate);
                        if (gfxvidinfo.bufmem) {
                                init_row_map ();
                                ret = 1;
@@ -883,12 +885,11 @@ int lockscr (void)
 void unlockscr (void)
 {
        if (currentmode->flags & DM_D3D) {
-               if ((currentmode->flags & DM_SWSCALE) && usedfilter->type != UAE_FILTER_NULL)
+               if (currentmode->flags & DM_SWSCALE)
                        S2X_render ();
-#ifdef D3D
-               D3D_flushtexture (flushymin, flushymax);
+               else
+                       D3D_flushtexture (flushymin, flushymax);
                D3D_unlocktexture ();
-#endif
        } else if (currentmode->flags & DM_SWSCALE) {
                return;
        } else if (currentmode->flags & DM_DDRAW) {
@@ -898,7 +899,7 @@ void unlockscr (void)
 
 void flush_clear_screen (void)
 {
-       if (lockscr ()) {
+       if (lockscr (true)) {
                int y;
                for (y = 0; y < gfxvidinfo.height; y++) {
                        memset (gfxvidinfo.bufmem + y * gfxvidinfo.rowbytes, 0, gfxvidinfo.width * gfxvidinfo.pixbytes);
@@ -1012,11 +1013,11 @@ void getrtgfilterrect2 (RECT *sr, RECT *dr, RECT *zr, int dst_width, int dst_hei
        picasso_offset_my = picasso96_state.Height * 1000 / (dr->bottom - dr->top);
 }
 
-uae_u8 *gfx_lock_picasso (void)
+uae_u8 *gfx_lock_picasso (int fullupdate)
 {
        if (currprefs.gfx_api) {
                int pitch;
-               uae_u8 *p = D3D_locktexture (&pitch);
+               uae_u8 *p = D3D_locktexture (&pitch, fullupdate);
                picasso_vidinfo.rowbytes = pitch;
                return p;
        } else {
@@ -1150,6 +1151,8 @@ static void update_gfxparams (void)
                : currprefs.color_mode == 2 ? 16 : 32;
        if (screen_is_picasso && currprefs.win32_rtgmatchdepth && isfullscreen () > 0) {
                int pbits = picasso96_state.BytesPerPixel * 8;
+               if (pbits <= 8)
+                       pbits = 16;
                if (pbits == 24)
                        pbits = 32;
                currentmode->current_depth = pbits;
@@ -1435,6 +1438,7 @@ int check_prefs_changed_gfx (void)
                currprefs.keyboard_leds[0] != changed_prefs.keyboard_leds[0] ||
                currprefs.keyboard_leds[1] != changed_prefs.keyboard_leds[1] ||
                currprefs.keyboard_leds[2] != changed_prefs.keyboard_leds[2] ||
+               currprefs.win32_minimize_inactive != changed_prefs.win32_minimize_inactive ||
                currprefs.win32_middle_mouse != changed_prefs.win32_middle_mouse ||
                currprefs.win32_active_priority != changed_prefs.win32_active_priority ||
                currprefs.win32_inactive_priority != changed_prefs.win32_inactive_priority ||
@@ -1445,6 +1449,7 @@ int check_prefs_changed_gfx (void)
                currprefs.win32_iconified_pause != changed_prefs.win32_iconified_pause ||
                currprefs.win32_ctrl_F11_is_quit != changed_prefs.win32_ctrl_F11_is_quit)
        {
+               currprefs.win32_minimize_inactive = changed_prefs.win32_minimize_inactive;
                currprefs.leds_on_screen = changed_prefs.leds_on_screen;
                currprefs.keyboard_leds[0] = changed_prefs.keyboard_leds[0];
                currprefs.keyboard_leds[1] = changed_prefs.keyboard_leds[1];
@@ -1756,7 +1761,7 @@ static int modeswitchneeded (struct winuae_currentmode *wc)
        if (isfullscreen () > 0) {
                /* fullscreen to fullscreen */
                if (screen_is_picasso) {
-                       if (picasso96_state.BytesPerPixel * 8 != wc->current_depth && currprefs.win32_rtgmatchdepth)
+                       if (picasso96_state.BytesPerPixel > 1 && picasso96_state.BytesPerPixel * 8 != wc->current_depth && currprefs.win32_rtgmatchdepth)
                                return -1;
                        if (picasso96_state.Width < wc->current_width && picasso96_state.Height < wc->current_height) {
                                if (currprefs.win32_rtgscaleifsmall && !currprefs.win32_rtgmatchdepth)
@@ -1767,9 +1772,9 @@ static int modeswitchneeded (struct winuae_currentmode *wc)
                                return 1;
                        if (picasso96_state.Width == wc->current_width &&
                                picasso96_state.Height == wc->current_height) {
-                                       if (picasso96_state.BytesPerPixel * 8 == wc->current_depth)
+                                       if (picasso96_state.BytesPerPixel * 8 == wc->current_depth || picasso96_state.BytesPerPixel == 1)
                                                return 0;
-                                       if (!currprefs.win32_rtgmatchdepth && wc->current_depth >= 16)
+                                       if (!currprefs.win32_rtgmatchdepth)
                                                return 0;
                        }
                        return 1;
@@ -2447,7 +2452,6 @@ static BOOL doInit (void)
                        gfxvidinfo.pixbytes = currentmode->current_depth >> 3;
                        gfxvidinfo.bufmem = 0;
                        gfxvidinfo.linemem = 0;
-                       gfxvidinfo.emergmem = scrlinebuf; // memcpy from system-memory to video-memory
                        gfxvidinfo.width = (currentmode->amiga_width + 7) & ~7;
                        gfxvidinfo.height = currentmode->amiga_height;
                        gfxvidinfo.maxblocklines = 0; // flush_screen actually does everything
@@ -2468,6 +2472,7 @@ static BOOL doInit (void)
        picasso_vidinfo.depth = currentmode->current_depth;
        picasso_vidinfo.offset = 0;
 #endif
+       gfxvidinfo.emergmem = scrlinebuf; // memcpy from system-memory to video-memory
 
        xfree (gfxvidinfo.realbufmem);
        gfxvidinfo.realbufmem = NULL;
index 35efa1f0e8c4c80d0baa8a7a8518cb941a37d3f3..d4bc039fed4fe18b78a88d18a7e2ef23bf361576 100644 (file)
@@ -6882,6 +6882,7 @@ static void values_to_miscdlg (HWND hDlg)
 
        if (currentpage == MISC1_ID) {
 
+               CheckDlgButton (hDlg, IDC_FOCUSMINIMIZE, workprefs.win32_minimize_inactive);
                CheckDlgButton (hDlg, IDC_ILLEGAL, workprefs.illegal_mem);
                CheckDlgButton (hDlg, IDC_SHOWGUI, workprefs.start_gui);
                CheckDlgButton (hDlg, IDC_JULIAN, workprefs.win32_middle_mouse);
@@ -7089,6 +7090,9 @@ 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_FOCUSMINIMIZE:
+                       workprefs.win32_minimize_inactive = IsDlgButtonChecked (hDlg, IDC_FOCUSMINIMIZE);
+                       break;
                case IDC_SHOWLEDS:
                        workprefs.leds_on_screen &= ~STATUSLINE_CHIPSET;
                        if (IsDlgButtonChecked(hDlg, IDC_SHOWLEDS))
index 022706d0586492706f3bb7b6ab39943f99b5b064..a54543a788aabfbdcade9c11858352a837491293 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "options.h"
 #include "events.h"
+#include "custom.h"
 
 #include "dxwrap.h"
 
@@ -22,6 +23,8 @@ static LPDIRECTSOUNDCAPTUREBUFFER lpDSBprimary2r = NULL;
 static LPDIRECTSOUNDCAPTUREBUFFER lpDSB2r = NULL;
 static int inited;
 static uae_u8 *samplebuffer;
+static int samplerate = 44100;
+static float clockspersample;
 
 static int capture_init (void)
 {
@@ -31,7 +34,7 @@ static int capture_init (void)
 
        wavfmt.wFormatTag = WAVE_FORMAT_PCM;
        wavfmt.nChannels = 2;
-       wavfmt.nSamplesPerSec = 44100;
+       wavfmt.nSamplesPerSec = samplerate;
        wavfmt.wBitsPerSample = 16;
        wavfmt.nBlockAlign = wavfmt.wBitsPerSample / 8 * wavfmt.nChannels;
        wavfmt.nAvgBytesPerSec = wavfmt.nBlockAlign * wavfmt.nSamplesPerSec;
@@ -48,13 +51,13 @@ static int capture_init (void)
        sound_buffer_rec.lpwfxFormat = &wavfmt;
        sound_buffer_rec.dwFlags = 0 ;
 
-       hr = IDirectSoundCapture_CreateCaptureBuffer (lpDS2r, &sound_buffer_rec, &lpDSB2r, NULL);
+       hr = lpDS2r->CreateCaptureBuffer (&sound_buffer_rec, &lpDSB2r, NULL);
        if (FAILED (hr)) {
                write_log (L"SAMPLER: CreateCaptureSoundBuffer() failure: %s\n", DXError(hr));
                return 0;
        }
 
-       hr = IDirectSoundCaptureBuffer_Start (lpDSB2r, DSCBSTART_LOOPING);
+       hr = lpDSB2r->Start (DSCBSTART_LOOPING);
        if (FAILED (hr)) {
                write_log (L"SAMPLER: DirectSoundCaptureBuffer_Start failed: %s\n", DXError (hr));
                return 0;
@@ -66,17 +69,20 @@ static int capture_init (void)
 
 static void capture_free (void)
 {
-       if (lpDSB2r)
-               IDirectSoundCaptureBuffer_Release (lpDSB2r);
+       if (lpDSB2r) {
+               lpDSB2r->Stop ();
+               lpDSB2r->Release ();
+       }
        lpDSB2r = NULL;
        if (lpDS2r)
-               IDirectSound_Release (lpDS2r);
+               lpDS2r->Release ();
        lpDS2r = NULL;
        xfree (samplebuffer);
        samplebuffer = NULL;
 }
 
 static evt oldcycles;
+static int oldoffset;
 
 uae_u8 sampler_getsample (void)
 {
@@ -86,34 +92,55 @@ uae_u8 sampler_getsample (void)
        DWORD len1, len2;
        evt cycles;
        int offset;
+       int sample, samplecnt;
+       uae_s16 *sbuf = (uae_s16*)samplebuffer;
 
        if (!inited) {
                if (!capture_init ())
                        return 0;
                inited = 1;
        }
-       cycles = get_cycles ();
-       offset = (cycles - oldcycles) / CYCLE_UNIT;
+       sample = 0;
+       samplecnt = 0;
+       cycles = get_cycles () - oldcycles;
+       offset = cycles / clockspersample;
        if (offset >= SAMPLEBUFFER || offset < 0) {
+               if (offset >= SAMPLEBUFFER) {
+                       while (oldoffset < SAMPLEBUFFER) {
+                               sample += sbuf[oldoffset * 2];
+                               oldoffset++;
+                               samplecnt++;
+                       }
+               }
                oldcycles = cycles;
-               offset = 0;
                cap_pos = 0;
-               hr = IDirectSoundCaptureBuffer_GetCurrentPosition (lpDSB2r, &t, &cur_pos);
+               hr = lpDSB2r->GetCurrentPosition (&t, &cur_pos);
                if (FAILED (hr))
                        return 0;
-               hr = IDirectSoundCaptureBuffer_Lock (lpDSB2r, cap_pos, SAMPLEBUFFER, &p1, &len1, &p2, &len2, 0);
+               hr = lpDSB2r->Lock (cap_pos, SAMPLEBUFFER, &p1, &len1, &p2, &len2, 0);
                if (FAILED (hr))
                        return 0;
                memcpy (samplebuffer, p1, len1);
                if (p2)
                        memcpy (samplebuffer + len1, p2, len2);
-               IDirectSoundCaptureBuffer_Unlock (lpDSB2r, p1, len1, p2, len2);
+               lpDSB2r->Unlock (p1, len1, p2, len2);
+               offset = 0;
+       }
+       while (oldoffset <= offset) {
+               sample += ((uae_s16*)samplebuffer)[oldoffset * 2];
+               oldoffset++;
+               samplecnt++;
        }
-       return samplebuffer[offset * 4 + 1];
+       oldoffset = offset;
+       if (samplecnt > 0)
+               sample /= samplecnt;
+       return sample >> 8;
 }
 
 int sampler_init (void)
 {
+       clockspersample = (float)maxvpos * maxhpos * vblank_hz * CYCLE_UNIT / samplerate;
+       oldcycles = get_cycles ();
        if (!currprefs.parallel_sampler)
                return 0;
        return 1;