From: Toni Wilen Date: Sun, 16 Oct 2022 16:14:59 +0000 (+0300) Subject: Removed obsolete xp/vista/win7 version checks X-Git-Tag: 41000~112 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=ff4ca68c05d3d1263bb7e63cf1b806f36a650959;p=francis%2Fwinuae.git Removed obsolete xp/vista/win7 version checks --- diff --git a/od-win32/dinput.cpp b/od-win32/dinput.cpp index 658f9b80..e822602f 100644 --- a/od-win32/dinput.cpp +++ b/od-win32/dinput.cpp @@ -433,7 +433,7 @@ static int doregister_rawinput (bool add) rid[num].dwFlags = RIDEV_INPUTSINK; rid[num].hwndTarget = mon->hMainWnd; } - rid[num].dwFlags |= (os_vista ? RIDEV_DEVNOTIFY : 0); + rid[num].dwFlags |= RIDEV_DEVNOTIFY; } num++; @@ -448,7 +448,7 @@ static int doregister_rawinput (bool add) rid[num].dwFlags = RIDEV_INPUTSINK; rid[num].hwndTarget = mon->hMainWnd; } - rid[num].dwFlags |= RIDEV_NOHOTKEYS | (os_vista ? RIDEV_DEVNOTIFY : 0); + rid[num].dwFlags |= RIDEV_NOHOTKEYS | RIDEV_DEVNOTIFY; } num++; @@ -465,7 +465,7 @@ static int doregister_rawinput (bool add) rid[num].dwFlags = RIDEV_INPUTSINK; rid[num].hwndTarget = mon->hMainWnd; } - rid[num].dwFlags |= (os_vista ? RIDEV_DEVNOTIFY : 0); + rid[num].dwFlags |= RIDEV_DEVNOTIFY; } num++; @@ -479,7 +479,7 @@ static int doregister_rawinput (bool add) rid[num].dwFlags = RIDEV_INPUTSINK; rid[num].hwndTarget = mon->hMainWnd; } - rid[num].dwFlags |= (os_vista ? RIDEV_DEVNOTIFY : 0); + rid[num].dwFlags |= RIDEV_DEVNOTIFY; } num++; } @@ -2080,7 +2080,7 @@ static void initialize_windowsmouse (void) } winmousewheelbuttonstart = did->buttons; if (i == 0) { - did->axles = os_vista ? 4 : 3; + did->axles = 4; did->axissort[0] = 0; did->axisname[0] = my_strdup (_T("X Axis")); did->axissort[1] = 1; @@ -2615,8 +2615,6 @@ bool is_hid_rawinput(void) return false; if (!rawinput_enabled_hid && !rawinput_enabled_hid_reset) return false; - if (!os_vista) - return false; return true; } @@ -3204,9 +3202,6 @@ static int di_do_init (void) rawinput_enabled_hid_reset = 0; } - if (!os_vista && rawinput_enabled_hid < 0) - rawinput_enabled_hid = 0; - #if 0 IsXInputDevice(NULL); #endif diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 34719800..1411940f 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -3211,9 +3211,6 @@ int can_D3D11(bool checkdevice) detected = true; - if (!os_win7) - return 0; - if (!hd3d11) hd3d11 = LoadLibrary(_T("D3D11.dll")); if (!hdxgi) @@ -3285,6 +3282,7 @@ int can_D3D11(bool checkdevice) HRESULT hr = pD3D11CreateDevice(NULL, currprefs.gfx_api_options == 0 ? D3D_DRIVER_TYPE_HARDWARE : D3D_DRIVER_TYPE_WARP, NULL, cdflags, levels, 1, D3D11_SDK_VERSION, &m_device, NULL, &m_deviceContext); if (FAILED(hr)) { + write_log(_T("D3D11 check failed. %08x\n"), hr); return 0; } m_deviceContext->Release(); diff --git a/od-win32/fsdb_win32.cpp b/od-win32/fsdb_win32.cpp index 94f22e3d..bc8b298d 100644 --- a/od-win32/fsdb_win32.cpp +++ b/od-win32/fsdb_win32.cpp @@ -372,8 +372,6 @@ static int fsdb_name_invalid_2 (a_inode *aino, const TCHAR *n, int dir) int v = fsdb_name_invalid_2x(n, dir); if (v <= 1 || !aino) return v; - if (!os_win7) - return 1; TCHAR *p = build_nname(aino->nname, n); HANDLE h = CreateFile(p, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL); DWORD err = -1; diff --git a/od-win32/mman.cpp b/od-win32/mman.cpp index 6c4922d7..fc212404 100644 --- a/od-win32/mman.cpp +++ b/od-win32/mman.cpp @@ -238,12 +238,6 @@ bool preinit_shm (void) } if (!natmem_reserved) { DWORD vaflags = MEM_RESERVE | MEM_WRITE_WATCH; -#ifdef _WIN32 -#ifndef _WIN64 - if (!os_vista) - vaflags |= MEM_TOP_DOWN; -#endif -#endif for (;;) { natmem_reserved = (uae_u8*)VirtualAlloc (NULL, natmem_size, vaflags, PAGE_READWRITE); if (natmem_reserved) diff --git a/od-win32/sounddep/sound.cpp b/od-win32/sounddep/sound.cpp index 17052805..bc60e319 100644 --- a/od-win32/sounddep/sound.cpp +++ b/od-win32/sounddep/sound.cpp @@ -3108,10 +3108,10 @@ int enumerate_sound_devices (void) { if (!num_sound_devices) { HMODULE l = NULL; - if (os_vista && (sounddrivermask & SOUNDDRIVER_WASAPI)) { + if (sounddrivermask & SOUNDDRIVER_WASAPI) { wasapi_enum(sound_devices); } - if ((1 || force_directsound || !os_vista) && (sounddrivermask & SOUNDDRIVER_DS)) { + if ((1 || force_directsound) && (sounddrivermask & SOUNDDRIVER_DS)) { write_log(_T("Enumerating DirectSound devices..\n")); DirectSoundEnumerate ((LPDSENUMCALLBACK)DSEnumProc, sound_devices); DirectSoundCaptureEnumerate((LPDSENUMCALLBACK)DSEnumProc, record_devices); @@ -3327,19 +3327,13 @@ static int setget_master_volume_xp (int setvolume, int *volume, int *mute) static int set_master_volume (int volume, int mute) { - if (os_vista) - return setget_master_volume_vista (1, &volume, &mute); - else - return setget_master_volume_xp (1, &volume, &mute); + return setget_master_volume_vista (1, &volume, &mute); } static int get_master_volume (int *volume, int *mute) { *volume = 0; *mute = 0; - if (os_vista) - return setget_master_volume_vista (0, volume, mute); - else - return setget_master_volume_xp (0, volume, mute); + return setget_master_volume_vista (0, volume, mute); } void sound_mute (int newmute) diff --git a/od-win32/win32.cpp b/od-win32/win32.cpp index 59731694..8654f628 100644 --- a/od-win32/win32.cpp +++ b/od-win32/win32.cpp @@ -1195,7 +1195,7 @@ static void winuae_active(struct AmigaMonitor *mon, HWND hwnd, int minimized) #endif clipboard_active(mon->hAmigaWnd, 1); #if USETHREADCHARACTERICS - if (os_vista && AVTask == NULL) { + if (AVTask == NULL) { typedef HANDLE(WINAPI* AVSETMMTHREADCHARACTERISTICS)(LPCTSTR, LPDWORD); DWORD taskIndex = 0; AVSETMMTHREADCHARACTERISTICS pAvSetMmThreadCharacteristics = @@ -4282,7 +4282,7 @@ void target_default_options (struct uae_prefs *p, int type) p->win32_commandpathstart[0] = 0; p->win32_commandpathend[0] = 0; p->win32_statusbar = 1; - p->gfx_api = os_win7 ? 2 : (os_vista ? 1 : 0); + p->gfx_api = 2; if (p->gfx_api > 1) p->color_mode = 5; if (p->gf[APMODE_NATIVE].gfx_filter == 0) diff --git a/od-win32/win32.h b/od-win32/win32.h index 47dd953a..9e838a42 100644 --- a/od-win32/win32.h +++ b/od-win32/win32.h @@ -91,7 +91,7 @@ extern int pause_emulation; extern int sound_available; extern TCHAR VersionStr[256]; extern TCHAR BetaStr[64]; -extern int os_admin, os_64bit, os_vista, os_win7, os_win8, os_win10, cpu_number, os_touch; +extern int os_admin, os_64bit, os_win8, os_win10, cpu_number, os_touch; extern BOOL os_dwm_enabled, dpi_aware_v2; extern OSVERSIONINFO osVersion; extern int paraport_mask; diff --git a/od-win32/win32gfx.cpp b/od-win32/win32gfx.cpp index 1457a49e..d3ce3fc4 100644 --- a/od-win32/win32gfx.cpp +++ b/od-win32/win32gfx.cpp @@ -828,8 +828,6 @@ static void modesList (struct MultiDisplay *md) static void adjustappbar(RECT *monitor, RECT *workrect) { - if (!os_vista) - return; APPBARDATA abd; // Isn't this ugly API? for (int i = 0; i < 4; i++) { @@ -928,7 +926,7 @@ static void getd3dmonitornames (void) { // XP does not support hybrid displays, don't load Direct3D // Windows 10+ seems to use same names by default - if (!os_vista || os_win10) + if (os_win10) return; IDirect3D9 *d3d = Direct3DCreate9 (D3D_SDK_VERSION); if (!d3d) @@ -3132,8 +3130,6 @@ uae_u32 OSDEP_minimize_uae (void) typedef HRESULT (CALLBACK* DWMENABLEMMCSS)(BOOL); static void setDwmEnableMMCSS (bool state) { - if (!os_vista) - return; HMODULE hm = GetModuleHandle(_T("dwmapi.dll")); if (hm) { DWMENABLEMMCSS pDwmEnableMMCSS; diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index 7a5b024a..e7948093 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -1276,62 +1276,48 @@ static int drag_start (HWND hWnd, HWND hListView, LPARAM lParam) RECT rc2; GetClientRect(hListView, &rc2); - if (!os_vista) { - - IMAGEINFO imf; - POINT p; - // For the first selected item, - // we simply create a single-line drag image - hDragImageList = ListView_CreateDragImage(hListView, iPos, &p); - ImageList_GetImageInfo(hDragImageList, 0, &imf); - width = imf.rcImage.right; - height = imf.rcImage.bottom; - - } else { - - // ListView_CreateDragImage replacement hack follows.. - RECT rc; - // Get Rectangle of selected ListView Item - ListView_GetItemRect(hListView, iPos, &rc, LVIR_BOUNDS); - if (rc.left < 0) - rc.left = 0; - if (rc.bottom < 0) - rc.bottom = 0; - width = rc.right - rc.left; - height = rc.bottom - rc.top; - if (width <= 0 || height <= 0) - return 0; - // Image becomes blank bar if visible part - // is smaller than complete width of item. - if (width > rc2.right - rc2.left) - width = rc2.right - rc2.left; - if (height > rc2.bottom - rc2.top) - height = rc2.bottom - rc2.top; - - // Create HBITMAP of selected ListView Item - HDC hDC = GetDC(hListView); - if (hDC) { - HDC hMemDC = CreateCompatibleDC(hDC); - if (hMemDC) { - - HBITMAP hBMP = CreateCompatibleBitmap(hDC, width, height); - if (hBMP) { - HGDIOBJ o = SelectObject(hMemDC, hBMP); - BitBlt(hMemDC, 0, 0, width, height, hDC, rc.left, rc.top, SRCCOPY); - SelectObject(hMemDC, o); - } - - // Create ImageList, add HBITMAP to ImageList. - hDragImageList = ImageList_Create(width, height, ILC_COLOR24, 1, 1); - if (hBMP && hDragImageList) { - ImageList_Add(hDragImageList, hBMP, NULL); - DeleteObject(hBMP); - } + // ListView_CreateDragImage replacement hack follows.. + RECT rc; + // Get Rectangle of selected ListView Item + ListView_GetItemRect(hListView, iPos, &rc, LVIR_BOUNDS); + if (rc.left < 0) + rc.left = 0; + if (rc.bottom < 0) + rc.bottom = 0; + width = rc.right - rc.left; + height = rc.bottom - rc.top; + if (width <= 0 || height <= 0) + return 0; + // Image becomes blank bar if visible part + // is smaller than complete width of item. + if (width > rc2.right - rc2.left) + width = rc2.right - rc2.left; + if (height > rc2.bottom - rc2.top) + height = rc2.bottom - rc2.top; + + // Create HBITMAP of selected ListView Item + HDC hDC = GetDC(hListView); + if (hDC) { + HDC hMemDC = CreateCompatibleDC(hDC); + if (hMemDC) { + + HBITMAP hBMP = CreateCompatibleBitmap(hDC, width, height); + if (hBMP) { + HGDIOBJ o = SelectObject(hMemDC, hBMP); + BitBlt(hMemDC, 0, 0, width, height, hDC, rc.left, rc.top, SRCCOPY); + SelectObject(hMemDC, o); + } - DeleteDC(hMemDC); + // Create ImageList, add HBITMAP to ImageList. + hDragImageList = ImageList_Create(width, height, ILC_COLOR24, 1, 1); + if (hBMP && hDragImageList) { + ImageList_Add(hDragImageList, hBMP, NULL); + DeleteObject(hBMP); } - ReleaseDC(hListView, hDC); + + DeleteDC(hMemDC); } + ReleaseDC(hListView, hDC); } offset.x = rc2.left; @@ -6414,7 +6400,7 @@ static INT_PTR CALLBACK ErrorLogProc (HWND hDlg, UINT msg, WPARAM wParam, LPARAM xSendDlgItemMessage (hDlg, IDC_ERRORLOGMESSAGE, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat); CharFormat.dwMask |= CFM_SIZE | CFM_FACE; CharFormat.yHeight = 8 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */ - _tcscpy (CharFormat.szFaceName, os_vista ? _T("Segoe UI") : _T("Tahoma")); + _tcscpy (CharFormat.szFaceName, _T("Segoe UI")); xSendDlgItemMessage (hDlg, IDC_ERRORLOGMESSAGE, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat); return TRUE; } @@ -6451,7 +6437,7 @@ static INT_PTR CALLBACK ContributorsProc (HWND hDlg, UINT msg, WPARAM wParam, LP CharFormat.dwMask |= CFM_SIZE | CFM_FACE; CharFormat.yHeight = 8 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */ - _tcscpy (CharFormat.szFaceName, os_vista ? _T("Segoe UI") : _T("Tahoma")); + _tcscpy (CharFormat.szFaceName, _T("Segoe UI")); xSendDlgItemMessage (hDlg, IDC_CONTRIBUTORS, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat); return TRUE; } @@ -6500,7 +6486,7 @@ static void SetupRichText(HWND hDlg, urlinfo *url) CharFormat.yHeight = 10 * 20; /* height in twips, where a twip is 1/20th of a point - for a pt.size of 18 */ CharFormat.crTextColor = GetSysColor (COLOR_ACTIVECAPTION); - _tcscpy (CharFormat.szFaceName, os_vista ? _T("Segoe UI") : _T("Tahoma")); + _tcscpy (CharFormat.szFaceName, _T("Segoe UI")); xSendDlgItemMessage (hDlg, url->id, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&CharFormat); xSendDlgItemMessage (hDlg, url->id, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE)); } @@ -7840,7 +7826,7 @@ static void init_aboutdlg (HWND hDlg) CharFormat.dwEffects = CFE_BOLD; CharFormat.yHeight = 24 * 20; /* height in twips, where a twip is 1/20th of a point */ - _tcscpy (CharFormat.szFaceName, os_vista ? _T("Segoe UI") : _T("Tahoma")); + _tcscpy (CharFormat.szFaceName, _T("Segoe UI")); xSendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat); xSendDlgItemMessage (hDlg, IDC_RICHEDIT1, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE)); @@ -7848,7 +7834,7 @@ static void init_aboutdlg (HWND hDlg) xSendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_GETCHARFORMAT, 0, (LPARAM) & CharFormat); CharFormat.dwMask |= CFM_SIZE | CFM_FACE; CharFormat.yHeight = 12 * 20; - _tcscpy (CharFormat.szFaceName, os_vista ? _T("Segoe UI") : _T("Tahoma")); + _tcscpy (CharFormat.szFaceName, _T("Segoe UI")); xSendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETCHARFORMAT, SCF_ALL, (LPARAM) & CharFormat); xSendDlgItemMessage (hDlg, IDC_RICHEDIT2, EM_SETBKGNDCOLOR, 0, GetSysColor (COLOR_3DFACE)); diff --git a/od-win32/win32gui_extra.cpp b/od-win32/win32gui_extra.cpp index 209481e7..da4063cc 100644 --- a/od-win32/win32gui_extra.cpp +++ b/od-win32/win32gui_extra.cpp @@ -83,12 +83,9 @@ typedef struct { } DLGITEMTEMPLATEEX; #include -static int font_vista_ok; static const wchar_t wfont_vista[] = _T("Segoe UI"); -static const wchar_t wfont_xp[] = _T("Tahoma"); static const wchar_t wfont_old[] = _T("MS Sans Serif"); static const TCHAR font_vista[] = _T("Segoe UI"); -static const TCHAR font_xp[] = _T("Tahoma"); #define WNDS_DIALOGWINDOW 0X00010000 #define CW_USEDEFAULT16 ((short)0x8000) @@ -892,14 +889,12 @@ static void scaleresource_setfont(struct newresource *nr, HWND hDlg) { if (!nr) return; - if (os_vista) { - for (int i = 0; i < nr->setparamcnt; i++) { - HWND hwnd = GetDlgItem(hDlg, nr->setparam_id[i]); - if (hwnd) { - int v = (int)SendMessage(hwnd, CB_GETITEMHEIGHT, -1, NULL); - if (v > 0 && mmy(v) > v) - SendMessage(hwnd, CB_SETITEMHEIGHT, -1, mmy(v)); - } + for (int i = 0; i < nr->setparamcnt; i++) { + HWND hwnd = GetDlgItem(hDlg, nr->setparam_id[i]); + if (hwnd) { + int v = (int)SendMessage(hwnd, CB_GETITEMHEIGHT, -1, NULL); + if (v > 0 && mmy(v) > v) + SendMessage(hwnd, CB_SETITEMHEIGHT, -1, mmy(v)); } } } @@ -1123,11 +1118,11 @@ static void setdeffont (void) } fontsize_default = fs; - _tcscpy (fontname_gui, font_vista_ok ? wfont_vista : wfont_xp); + _tcscpy (fontname_gui, wfont_vista); fontsize_gui = fontsize_default; fontstyle_gui = 0; fontweight_gui = FW_REGULAR; - _tcscpy (fontname_list, font_vista_ok ? wfont_vista : wfont_xp); + _tcscpy (fontname_list, wfont_vista); fontsize_list = fontsize_default; fontstyle_list = 0; fontweight_list = FW_REGULAR; @@ -1204,9 +1199,6 @@ void scaleresource_modification(HWND hwnd) void scaleresource_init(const TCHAR *prefix, int fullscreen) { - if (os_vista) - font_vista_ok = 1; - fontprefix = prefix; setdeffont(); @@ -1325,7 +1317,7 @@ extern int gui_fullscreen; void getextendedframebounds(HWND hwnd, RECT *r) { - if (!pDwmGetWindowAttribute && !dwmapihandle && os_vista) { + if (!pDwmGetWindowAttribute && !dwmapihandle) { dwmapihandle = LoadLibrary(_T("dwmapi.dll")); if (dwmapihandle) pDwmGetWindowAttribute = (DWMGETWINDOWATTRIBUTE)GetProcAddress(dwmapihandle, "DwmGetWindowAttribute");