From 3f6e5d8381a9970c3cccb5a1bab3df283d18c1d6 Mon Sep 17 00:00:00 2001 From: Barry Harris <44396066+barry65536@users.noreply.github.com> Date: Fri, 9 Jun 2017 19:05:10 +0000 Subject: [PATCH] Allow user to choose full-screen monitor - Part 2 --- makefile.burner_win32_rules | 2 +- src/burner/win32/app.rc | 20 +++++ src/burner/win32/burner_win32.h | 3 + src/burner/win32/choose_monitor.cpp | 101 ++++++++++++++++++++++++++ src/burner/win32/resource.h | 7 ++ src/burner/win32/scrn.cpp | 8 ++ src/intf/video/win32/vid_directx9.cpp | 39 ++++++++++ 7 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 src/burner/win32/choose_monitor.cpp diff --git a/makefile.burner_win32_rules b/makefile.burner_win32_rules index 294911b5e..5b74fcd30 100644 --- a/makefile.burner_win32_rules +++ b/makefile.burner_win32_rules @@ -2,7 +2,7 @@ alldir += burner burner/win32 dep/kaillera/client dep/libs/libpng dep/libs/lib7 intf/video/scalers intf/video/win32 intf/audio intf/audio/win32 intf/input intf/input/win32 intf/cd intf/cd/win32 \ intf/perfcount intf/perfcount/win32 dep/generated -depobj += about.o bzip.o cona.o debugger.o drv.o dynhuff.o fba_kaillera.o gameinfo.o image_win32.o inpc.o \ +depobj += about.o bzip.o choose_monitor.o cona.o debugger.o drv.o dynhuff.o fba_kaillera.o gameinfo.o image_win32.o inpc.o \ inpcheat.o inpd.o inpdipsw.o inps.o ips_manager.o localise.o localise_download.o localise_gamelist.o main.o \ media.o memcard.o menu.o misc_win32.o neocdlist.o neocdsel.o numdial.o paletteviewer.o popup_win32.o progress.o \ replay.o res.o roms.o run.o scrn.o sel.o sfactd.o splash.o stated.o support_paths.o systeminfo.o wave.o \ diff --git a/src/burner/win32/app.rc b/src/burner/win32/app.rc index 876ad0bf0..da5585094 100644 --- a/src/burner/win32/app.rc +++ b/src/burner/win32/app.rc @@ -927,6 +927,25 @@ BEGIN CONTROL "Record From Power-On",IDC_REPLAYRESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,55,79,106,14 END +IDD_CHOOSEMONITOR DIALOGEX 0, 0, 242, 77 +STYLE DS_MODALFRAME | DS_CENTER | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Choose Monitor for Full Screen" +#ifdef USE_SEGOE +FONT 8, "Segoe UI", 0, 0, 0x1 +#else +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +#endif +BEGIN + GROUPBOX "",IDC_STATIC1,2,0,236,56 + LTEXT "These only apply to the DirectX Graphics 9 blitters.",IDC_CHOOSE_MONITOR_TEXT,8,4,210,15,SS_CENTERIMAGE + LTEXT "Horizontal Games:", IDC_CHOOSE_MONITOR_HOR, 8, 21, 60, 10, SS_CENTERIMAGE + COMBOBOX IDC_CHOOSE_MONITOR_HOR_LIST, 80, 20, 150, 128, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL + LTEXT "Vertical Games:", IDC_CHOOSE_MONITOR_VER, 8, 39, 60, 10, SS_CENTERIMAGE + COMBOBOX IDC_CHOOSE_MONITOR_VER_LIST, 80, 38, 150, 128, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL + CONTROL "Cancel",IDCANCEL,"Button",WS_TABSTOP,117,59,58,14 + CONTROL "OK",IDOK,"Button",WS_TABSTOP,180,59,58,14 +END + ///////////////////////////////////////////////////////////////////////////// // // Menu @@ -1082,6 +1101,7 @@ BEGIN MENUITEM "&24bit", MENU_24 MENUITEM "&32bit", MENU_32 END + MENUITEM "Choose Fullscreen Monitor", MENU_FULLSCREEN_MONITOR MENUITEM SEPARATOR POPUP "&Monitor properties" BEGIN diff --git a/src/burner/win32/burner_win32.h b/src/burner/win32/burner_win32.h index 8cad3d992..089298eed 100644 --- a/src/burner/win32/burner_win32.h +++ b/src/burner/win32/burner_win32.h @@ -467,6 +467,9 @@ void IpsPatchExit(); // localise_download.cpp int LocaliseDownloadCreate(HWND hParentWND); +// choose_monitor.cpp +int ChooseMonitorCreate(); + // Misc #define _TtoA(a) TCHARToANSI(a, NULL, 0) #define _AtoT(a) ANSIToTCHAR(a, NULL, 0) diff --git a/src/burner/win32/choose_monitor.cpp b/src/burner/win32/choose_monitor.cpp new file mode 100644 index 000000000..db266fe07 --- /dev/null +++ b/src/burner/win32/choose_monitor.cpp @@ -0,0 +1,101 @@ +#include "burner.h" + +#define MAX_MONITORS 8 + +static TCHAR *MonitorIDs[MAX_MONITORS]; + +static INT_PTR CALLBACK ResProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM) +{ + static bool bOK; + + switch (Msg) { + case WM_INITDIALOG: { + int i; + int nHorSelected = 0, nVerSelected = 0; + + for (i = 0; i < MAX_MONITORS; i++) { + MonitorIDs[i] = (TCHAR*)malloc(32 * sizeof(TCHAR)); + memset(MonitorIDs[i], 0, 32 * sizeof(TCHAR)); + } + + DISPLAY_DEVICE dd; + ZeroMemory(&dd, sizeof(dd)); + dd.cb = sizeof(dd); + + for (i = 0; EnumDisplayDevices(NULL, i, &dd, 0); i++) { + if (dd.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP) { + DISPLAY_DEVICE dd2; + ZeroMemory(&dd2, sizeof(dd2)); + dd2.cb = sizeof(dd2); + EnumDisplayDevices(dd.DeviceName, 0, &dd2, 0); + + // Add to dropdowns + TCHAR szTemp[256]; + _stprintf(szTemp, _T("%s"), dd2.DeviceString); + if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) _stprintf(szTemp, _T("%s (default)"), szTemp); + + SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_HOR_LIST, CB_ADDSTRING, 0, (LPARAM)&szTemp); + SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_VER_LIST, CB_ADDSTRING, 0, (LPARAM)&szTemp); + + // Store id for later + _stprintf(MonitorIDs[i], _T("%s"), dd.DeviceName); + + // Select if this is our value or the default + if (nHorSelected == 0) { + if (!_tcsicmp(HorScreen, MonitorIDs[i])) { + nHorSelected = 1; + SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_HOR_LIST, CB_SETCURSEL, i, 0); + } else { + if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_HOR_LIST, CB_SETCURSEL, i, 0); + } + } + + if (nVerSelected == 0) { + if (!_tcsicmp(VerScreen, MonitorIDs[i])) { + nVerSelected = 1; + SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_VER_LIST, CB_SETCURSEL, i, 0); + } else { + if (dd.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_VER_LIST, CB_SETCURSEL, i, 0); + } + } + } + } + + WndInMid(hDlg, hScrnWnd); + SetFocus(hDlg); // Enable Esc=close + break; + } + + case WM_COMMAND: { + if (LOWORD(wParam) == IDOK) { + bOK = 1; + SendMessage(hDlg, WM_CLOSE, 0, 0); + } + if (LOWORD(wParam) == IDCANCEL) { + SendMessage(hDlg, WM_CLOSE, 0, 0); + } + break; + } + + case WM_CLOSE: { + if (bOK) { + // save selected values + int nItem = (int)SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_HOR_LIST, CB_GETCURSEL, 0, 0); + if (MonitorIDs[(int)nItem]) _stprintf(HorScreen, _T("%s"), MonitorIDs[(int)nItem]); + + nItem = (int)SendDlgItemMessage(hDlg, IDC_CHOOSE_MONITOR_VER_LIST, CB_GETCURSEL, 0, 0); + if (MonitorIDs[(int)nItem]) _stprintf(VerScreen, _T("%s"), MonitorIDs[(int)nItem]); + } + EndDialog(hDlg, 0); + break; + } + } + + return 0; +} + +int ChooseMonitorCreate() +{ + FBADialogBox(hAppInst,MAKEINTRESOURCE(IDD_CHOOSEMONITOR),hScrnWnd,(DLGPROC)ResProc); + return 0; +} diff --git a/src/burner/win32/resource.h b/src/burner/win32/resource.h index 8dd79bbf6..a1da4148b 100644 --- a/src/burner/win32/resource.h +++ b/src/burner/win32/resource.h @@ -48,6 +48,7 @@ #define IDD_NCD_COVER_DLG 80 #define IDD_GAMEINFO 81 #define IDD_DOWNLOAD_LOCAL 82 +#define IDD_CHOOSEMONITOR 83 #define IDR_MENU 100 #define IDR_MENU_BLITTER_1 110 @@ -185,6 +186,11 @@ #define IDC_SYSINFO_LOG_SAVE 20138 #define IDC_LOCAL_DOWNLOAD_LANG 20139 #define IDC_SEL_SEARCHTIMER 20140 +#define IDC_CHOOSE_MONITOR_HOR 20141 +#define IDC_CHOOSE_MONITOR_HOR_LIST 20142 +#define IDC_CHOOSE_MONITOR_VER 20143 +#define IDC_CHOOSE_MONITOR_VER_LIST 20144 +#define IDC_CHOOSE_MONITOR_TEXT 20145 #define IDC_DRVCOUNT 20200 #define IDC_TREE2 20201 @@ -641,6 +647,7 @@ #define MENU_AVI2X 10725 #define MENU_AVI3X 10726 #define MENU_GEARSHIFT 10727 +#define MENU_FULLSCREEN_MONITOR 10728 #define MENU_BASIC_NORMAL 11001 #define MENU_BASIC_SCAN 11002 diff --git a/src/burner/win32/scrn.cpp b/src/burner/win32/scrn.cpp index a4cf5e237..06fc363a2 100644 --- a/src/burner/win32/scrn.cpp +++ b/src/burner/win32/scrn.cpp @@ -1361,6 +1361,14 @@ static void OnCommand(HWND /*hDlg*/, int id, HWND /*hwndCtl*/, UINT codeNotify) ResCreate(HORIZONTAL_ORIENTED_RES); GameInpCheckMouse(); break; + + case MENU_FULLSCREEN_MONITOR: + if (UseDialogs()) { + AudBlankSound(); + ChooseMonitorCreate(); + GameInpCheckMouse(); + } + break; // Vertical case MENU_RES_ARCADE_VERTICAL: diff --git a/src/intf/video/win32/vid_directx9.cpp b/src/intf/video/win32/vid_directx9.cpp index 2e19b021b..3e2796d47 100644 --- a/src/intf/video/win32/vid_directx9.cpp +++ b/src/intf/video/win32/vid_directx9.cpp @@ -840,6 +840,21 @@ static int dx9Init() return 1; } + nRotateGame = 0; + if (bDrvOkay) { + if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) { + if (nVidRotationAdjust & 1) { + nRotateGame |= (nVidRotationAdjust & 2); + } else { + nRotateGame |= 1; + } + } + + if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) { + nRotateGame ^= 2; + } + } + nD3DAdapter = D3DADAPTER_DEFAULT; if (nRotateGame & 1 && VerScreen[0]) { nD3DAdapter = dx9GetAdapter(VerScreen); @@ -1794,6 +1809,30 @@ static int dx9AltInit() dx9AltExit(); return 1; } + + nRotateGame = 0; + if (bDrvOkay) { + if (BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) { + if (nVidRotationAdjust & 1) { + nRotateGame |= (nVidRotationAdjust & 2); + } else { + nRotateGame |= 1; + } + } + + if (BurnDrvGetFlags() & BDF_ORIENTATION_FLIPPED) { + nRotateGame ^= 2; + } + } + + nD3DAdapter = D3DADAPTER_DEFAULT; + if (nRotateGame & 1 && VerScreen[0]) { + nD3DAdapter = dx9GetAdapter(VerScreen); + } else { + if (HorScreen[0]) { + nD3DAdapter = dx9GetAdapter(HorScreen); + } + } // check selected atapter D3DDISPLAYMODE dm;