From 31ab7e1d7d7deadd029cc21e26eed2080dede25a Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 5 Apr 2008 12:04:46 +0300 Subject: [PATCH] imported winuaesrc1500b12b.zip --- od-win32/rp.c | 33 ++++++++++++++++++++++++++------- od-win32/win32gui.c | 15 ++++----------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/od-win32/rp.c b/od-win32/rp.c index 4687ca4d..424c8306 100755 --- a/od-win32/rp.c +++ b/od-win32/rp.c @@ -193,6 +193,7 @@ static void get_screenmode (struct RPScreenMode *sm) int res = currprefs.gfx_resolution; int m = RP_SCREENMODE_1X; int full = 0; + int dbl = 0; if (WIN32GFX_IsPicassoScreen ()) { full = currprefs.gfx_pfullscreen; @@ -206,10 +207,16 @@ static void get_screenmode (struct RPScreenMode *sm) m = RP_SCREENMODE_2X; if (res == 2) m = RP_SCREENMODE_4X; + dbl = res >= 1 ? 1 : 0; sm->lClipLeft = currprefs.gfx_xcenter_pos; sm->lClipTop = currprefs.gfx_ycenter_pos; - sm->lClipWidth = LORES_WIDTH << currprefs.gfx_resolution; - sm->lClipHeight = LORES_HEIGHT << (currprefs.gfx_linedbl ? 1 : 0); + if (full) { + sm->lClipWidth = LORES_WIDTH << currprefs.gfx_resolution; + sm->lClipHeight = LORES_HEIGHT << (currprefs.gfx_linedbl ? 1 : 0); + } else { + sm->lClipWidth = currprefs.gfx_size_win.width << (RES_MAX - res); + sm->lClipHeight = currprefs.gfx_size_win.height << (1 - dbl); + } } if (full) { int d = (currprefs.gfx_display + 1) << 8; @@ -223,6 +230,7 @@ static void set_screenmode (struct RPScreenMode *sm) { int res = RP_SCREENMODE_MODE (sm->dwScreenMode); int fs = RP_SCREENMODE_DISPLAY (sm->dwScreenMode); + int dbl = 1; minimized = 0; if (fs) @@ -233,13 +241,24 @@ static void set_screenmode (struct RPScreenMode *sm) changed_prefs.gfx_afullscreen = fs; changed_prefs.gfx_resolution = res; if (res == 0) - changed_prefs.gfx_linedbl = 0; + dbl = changed_prefs.gfx_linedbl = 0; + else + dbl = changed_prefs.gfx_linedbl = 1; + if (sm->lClipWidth <= 0) + changed_prefs.gfx_size_win.width = LORES_WIDTH << res; else - changed_prefs.gfx_linedbl = 1; - res = 1 << res; - changed_prefs.gfx_size_win.width = default_width * res; - changed_prefs.gfx_size_win.height = default_height * res; + changed_prefs.gfx_size_win.width = sm->lClipWidth >> (RES_MAX - res); + if (sm->lClipHeight <= 0) + changed_prefs.gfx_size_win.height = LORES_HEIGHT << dbl; + else + changed_prefs.gfx_size_win.height = sm->lClipHeight >> (1 - dbl); + if (fs) { + changed_prefs.gfx_size_fs.width = changed_prefs.gfx_size_win.width; + changed_prefs.gfx_size_fs.height = changed_prefs.gfx_size_win.height; + } } + changed_prefs.gfx_xcenter_pos = sm->lClipLeft; + changed_prefs.gfx_ycenter_pos = sm->lClipTop; updatewinfsmode (&changed_prefs); WIN32GFX_DisplayChangeRequested (); hwndset = 0; diff --git a/od-win32/win32gui.c b/od-win32/win32gui.c index a0c59700..a5603cfb 100755 --- a/od-win32/win32gui.c +++ b/od-win32/win32gui.c @@ -1685,23 +1685,16 @@ static BOOL CreateHardFile (HWND hDlg, UINT hfsizem, char *dostype, char *newpat sparse = 0; hfsize = (uae_u64)hfsizem * 1024 * 1024; if (IsDlgButtonChecked (hDlg, IDC_HF_SPARSE) == BST_CHECKED) - sparse = -1; + sparse = 1; if (!DiskSelection (hDlg, IDC_PATH_NAME, 3, &workprefs, newpath)) return FALSE; GetDlgItemText (hDlg, IDC_PATH_NAME, init_path, MAX_DPATH); if (*init_path && hfsize) { SetCursor (LoadCursor(NULL, IDC_WAIT)); - if ((hf = CreateFile (init_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL) ) != INVALID_HANDLE_VALUE) { - DWORD mcl, fsf; - if (GetVolumeInformationByHandleW (hf, NULL, 0, NULL, &mcl, &fsf, NULL, 0)) { - if ((fsf & FILE_SUPPORTS_SPARSE_FILES) && sparse < 0) - sparse = 1; - } - if (sparse > 0) { + if ((hf = CreateFile (init_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)) != INVALID_HANDLE_VALUE) { + if (sparse) { DWORD ret; - int ok = 0; - if (DeviceIoControl (hf, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &ret, NULL)) - result = 1; + DeviceIoControl (hf, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &ret, NULL); } if (hfsize >= 0x80000000) { highword = (DWORD)(hfsize >> 32); -- 2.47.3