From: Toni Wilen Date: Sat, 20 Mar 2010 15:00:09 +0000 (+0200) Subject: 2100b18 X-Git-Tag: 2100~10 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=1086dffe5d6315faf43cec01326743e362bc6f76;p=francis%2Fwinuae.git 2100b18 --- diff --git a/disk.cpp b/disk.cpp index 895ad688..0f75a9cd 100644 --- 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; diff --git a/drawing.cpp b/drawing.cpp index 4b860ee2..124155fb 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -2740,7 +2740,7 @@ void finish_drawing_frame (void) { int i; - if (! lockscr ()) { + if (! lockscr (false)) { notice_screen_contents_lost (); return; } diff --git a/include/options.h b/include/options.h index 4954b4ab..9eb35415 100644 --- a/include/options.h +++ b/include/options.h @@ -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; diff --git a/include/xwin.h b/include/xwin.h index 3fee419f..6f780d7d 100644 --- a/include/xwin.h +++ b/include/xwin.h @@ -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); diff --git a/inputdevice.cpp b/inputdevice.cpp index 4f13f66b..d9bc0198 100644 --- a/inputdevice.cpp +++ b/inputdevice.cpp @@ -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); diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index cc07b44c..d93aaa01 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -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; } diff --git a/od-win32/direct3d.h b/od-win32/direct3d.h index ce55ceb5..de041714 100644 --- a/od-win32/direct3d.h +++ b/od-win32/direct3d.h @@ -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); diff --git a/od-win32/picasso96_win.cpp b/od-win32/picasso96_win.cpp index 67df02eb..b9b06775 100644 --- a/od-win32/picasso96_win.cpp +++ b/od-win32/picasso96_win.cpp @@ -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) { diff --git a/od-win32/picasso96_win.h b/od-win32/picasso96_win.h index 71ce7e54..09c3f616 100644 --- a/od-win32/picasso96_win.h +++ b/od-win32/picasso96_win.h @@ -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); diff --git a/od-win32/resources/resource b/od-win32/resources/resource index e30fd9a2..534fffdd 100644 --- a/od-win32/resources/resource +++ b/od-win32/resources/resource @@ -376,6 +376,8 @@ #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 @@ -1009,7 +1011,6 @@ #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 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index 5b542582..fc607449 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -460,10 +460,10 @@ FONT 8, "MS Sans Serif", 0, 0, 0x1 BEGIN GROUPBOX "Miscellaneous Options",IDC_STATIC,8,2,290,136 CONTROL "Untrap = middle button",IDC_JULIAN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,19,110,10 - CONTROL "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,31,109,10 + CONTROL "Show GUI on startup",IDC_SHOWGUI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,43,109,10 CONTROL "Native On-screen LEDs",IDC_SHOWLEDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,80,109,10 - CONTROL "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,56,109,10 - CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,43,110,10 + CONTROL "Don't show taskbar button",IDC_NOTASKBARBUTTON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,67,109,10 + CONTROL "Use CTRL-F11 to quit",IDC_CTRLF11,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,55,110,10 GROUPBOX "Keyboard LEDs",IDC_STATIC,7,140,85,94 COMBOBOX IDC_KBLED1,22,154,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_KBLED2,22,173,56,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -479,21 +479,22 @@ BEGIN COMBOBOX IDC_STATE_RATE,248,197,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP RTEXT "Recording buffer (MB):",IDC_STATIC,160,219,83,10,SS_CENTERIMAGE | WS_TABSTOP COMBOBOX IDC_STATE_BUFFERSIZE,248,217,38,65,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,69,110,10 + CONTROL "Always on top",IDC_ALWAYSONTOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,79,110,10 CONTROL "USB mode",IDC_KBLED_USB,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,22,216,64,10 COMBOBOX IDC_SCSIMODE,213,30,80,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_LANGUAGE,153,117,122,65,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP GROUPBOX "Language",IDC_STATIC,138,107,154,27 - CONTROL "Disable screensaver",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,82,109,10 + CONTROL "Disable screensaver",IDC_POWERSAVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,91,109,10 COMBOBOX IDC_DD_SURFACETYPE,213,63,79,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP RTEXT "DirectDraw display buffer:",IDC_STATIC,195,50,92,10,SS_CENTERIMAGE RTEXT "SCSI and CD/DVD access method:",IDC_STATIC,151,12,126,10,SS_CENTERIMAGE - CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,95,111,10 + CONTROL "Synchronize clock",IDC_CLOCKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,103,111,10 CONTROL "Faster RTG [] Enables less accurate custom chipset emulation mode when Picasso96 is enabled.",IDC_FASTERRTG, - "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,108,100,10 + "Button",BS_AUTOCHECKBOX | BS_LEFT | WS_GROUP | WS_TABSTOP,19,115,100,10 CONTROL "RTG On-screen LEDs",IDC_SHOWLEDSRTG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,138,93,109,10 LTEXT "Graphics API:",IDC_STATIC,136,49,62,10,SS_CENTERIMAGE COMBOBOX IDC_DXMODE,138,62,61,150,CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP + CONTROL "Minimize when focus is lost",IDC_FOCUSMINIMIZE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,19,31,110,10 END IDD_HARDFILE DIALOGEX 0, 0, 299, 249 @@ -1167,6 +1168,10 @@ BEGIN BOTTOMMARGIN, 237 END + IDD_MISC2, DIALOG + BEGIN + END + IDD_DISK, DIALOG BEGIN END diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 360de0c7..bed40be9 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -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; } diff --git a/od-win32/win32.h b/od-win32/win32.h index 8a052a76..42eb4bd2 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -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"" diff --git a/od-win32/win32_scaler.cpp b/od-win32/win32_scaler.cpp index 74894331..83527f63 100644 --- a/od-win32/win32_scaler.cpp +++ b/od-win32/win32_scaler.cpp @@ -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 { diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 8c32a8e5..ac8f182c 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -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; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 35efa1f0..d4bc039f 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -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)) diff --git a/sampler.cpp b/sampler.cpp index 022706d0..a54543a7 100644 --- a/sampler.cpp +++ b/sampler.cpp @@ -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;