diff --git a/src/common/Settings.cpp b/src/common/Settings.cpp index 6390a5b3c..d5f07724d 100644 --- a/src/common/Settings.cpp +++ b/src/common/Settings.cpp @@ -107,7 +107,7 @@ static struct { const char* Direct3DDevice = "Direct3DDevice"; const char* VSync = "VSync"; const char* FullScreen = "FullScreen"; - const char* HardwareYUV = "HardwareYUV"; + const char* MaintainAspect = "MaintainAspect"; const char* RenderResolution = "RenderResolution"; } sect_video_keys; @@ -401,7 +401,7 @@ bool Settings::LoadConfig() m_video.direct3DDevice = m_si.GetLongValue(section_video, sect_video_keys.Direct3DDevice, /*Default=*/0); m_video.bVSync = m_si.GetBoolValue(section_video, sect_video_keys.VSync, /*Default=*/false); m_video.bFullScreen = m_si.GetBoolValue(section_video, sect_video_keys.FullScreen, /*Default=*/false); - m_video.bHardwareYUV = m_si.GetBoolValue(section_video, sect_video_keys.HardwareYUV, /*Default=*/false); + m_video.bMaintainAspect = m_si.GetBoolValue(section_video, sect_video_keys.MaintainAspect, /*Default=*/true); m_video.renderScaleFactor = m_si.GetLongValue(section_video, sect_video_keys.RenderResolution, /*Default=*/1); // ==== Video End =========== @@ -569,7 +569,7 @@ bool Settings::Save(std::string file_path) m_si.SetLongValue(section_video, sect_video_keys.Direct3DDevice, m_video.direct3DDevice, nullptr, true, true); m_si.SetBoolValue(section_video, sect_video_keys.VSync, m_video.bVSync, nullptr, true); m_si.SetBoolValue(section_video, sect_video_keys.FullScreen, m_video.bFullScreen, nullptr, true); - m_si.SetBoolValue(section_video, sect_video_keys.HardwareYUV, m_video.bHardwareYUV, nullptr, true); + m_si.SetBoolValue(section_video, sect_video_keys.MaintainAspect, m_video.bMaintainAspect, nullptr, true); m_si.SetLongValue(section_video, sect_video_keys.RenderResolution, m_video.renderScaleFactor, nullptr, false, true); // ==== Video End =========== diff --git a/src/common/Settings.hpp b/src/common/Settings.hpp index 00ecba0f0..68e4a0dfc 100644 --- a/src/common/Settings.hpp +++ b/src/common/Settings.hpp @@ -116,7 +116,7 @@ public: unsigned int direct3DDevice; bool bVSync; bool bFullScreen; - bool bHardwareYUV; + bool bMaintainAspect; bool Reserved3; int renderScaleFactor = 1; int Reserved99[9] = { 0 }; diff --git a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp index 3c96390cc..45c261434 100644 --- a/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp +++ b/src/core/hle/D3D8/Direct3D9/Direct3D9.cpp @@ -5167,12 +5167,12 @@ DWORD WINAPI xbox::EMUPATCH(D3DDevice_Swap) const D3DTEXTUREFILTERTYPE LoadSurfaceFilter = D3DTEXF_LINEAR; const DWORD LoadOverlayFilter = D3DX_DEFAULT; + // Use backbuffer width/height since that may differ from the Window size + const auto width = g_XBVideo.bMaintainAspect ? g_AspectRatioScaleWidth * g_AspectRatioScale : g_HostBackBufferDesc.Width; + const auto height = g_XBVideo.bMaintainAspect ? g_AspectRatioScaleHeight * g_AspectRatioScale : g_HostBackBufferDesc.Height; + auto pXboxBackBufferHostSurface = GetHostSurface(g_pXbox_BackBufferSurface, D3DUSAGE_RENDERTARGET); if (pXboxBackBufferHostSurface) { - // Calculate the target width/height - const auto width = g_AspectRatioScaleWidth * g_AspectRatioScale; - const auto height = g_AspectRatioScaleHeight * g_AspectRatioScale; - // Calculate the centered rectangle RECT dest{}; dest.top = (LONG)((g_HostBackBufferDesc.Height - height) / 2); @@ -5254,8 +5254,6 @@ DWORD WINAPI xbox::EMUPATCH(D3DDevice_Swap) float xScale, yScale; GetMultiSampleScale(xScale, yScale); - const auto width = g_AspectRatioScaleWidth * g_AspectRatioScale; - const auto height = g_AspectRatioScaleHeight * g_AspectRatioScale; xScale = (float)width / ((float)XboxBackBufferWidth / xScale); yScale = (float)height / ((float)XboxBackBufferHeight / yScale); @@ -5271,10 +5269,6 @@ DWORD WINAPI xbox::EMUPATCH(D3DDevice_Swap) EmuDestRect.right += (LONG)((g_HostBackBufferDesc.Width - width) / 2); EmuDestRect.bottom += (LONG)((g_HostBackBufferDesc.Height - height) / 2); } else { - // Use backbuffer width/height since that may differ from the Window size - const auto width = g_AspectRatioScaleWidth * g_AspectRatioScale; - const auto height = g_AspectRatioScaleHeight * g_AspectRatioScale; - // Calculate the centered rectangle EmuDestRect.top = (LONG)((g_HostBackBufferDesc.Height - height) / 2); EmuDestRect.left = (LONG)((g_HostBackBufferDesc.Width - width) / 2); diff --git a/src/core/kernel/init/CxbxKrnl.cpp b/src/core/kernel/init/CxbxKrnl.cpp index f5eec0556..05d9e3bab 100644 --- a/src/core/kernel/init/CxbxKrnl.cpp +++ b/src/core/kernel/init/CxbxKrnl.cpp @@ -298,7 +298,7 @@ void PrintCurrentConfigurationLog() EmuLogInit(LOG_LEVEL::INFO, "Video Resolution: %s", XBVideoConf.szVideoResolution); EmuLogInit(LOG_LEVEL::INFO, "Force VSync is %s", XBVideoConf.bVSync ? "enabled" : "disabled"); EmuLogInit(LOG_LEVEL::INFO, "Fullscreen is %s", XBVideoConf.bFullScreen ? "enabled" : "disabled"); - EmuLogInit(LOG_LEVEL::INFO, "Hardware YUV is %s", XBVideoConf.bHardwareYUV ? "enabled" : "disabled"); + EmuLogInit(LOG_LEVEL::INFO, "Maintain Aspect is %s", XBVideoConf.bMaintainAspect ? "enabled" : "disabled"); } // Print current audio configuration diff --git a/src/gui/DlgVideoConfig.cpp b/src/gui/DlgVideoConfig.cpp index 8d61f4714..6538857b9 100644 --- a/src/gui/DlgVideoConfig.cpp +++ b/src/gui/DlgVideoConfig.cpp @@ -151,7 +151,7 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR SendMessage(GetDlgItem(hWndDlg, IDC_CV_VSYNC), BM_SETCHECK, (WPARAM)g_XBVideo.bVSync, 0); - SendMessage(GetDlgItem(hWndDlg, IDC_CV_HARDWAREYUV), BM_SETCHECK, (WPARAM)g_XBVideo.bHardwareYUV, 0); + SendMessage(GetDlgItem(hWndDlg, IDC_CV_MAINTAINASPECT), BM_SETCHECK, (WPARAM)g_XBVideo.bMaintainAspect, 0); } } break; @@ -224,9 +224,9 @@ INT_PTR CALLBACK DlgVideoConfigProc(HWND hWndDlg, UINT uMsg, WPARAM wParam, LPAR g_XBVideo.bVSync = (lRet == BST_CHECKED); - lRet = SendMessage(GetDlgItem(hWndDlg, IDC_CV_HARDWAREYUV), BM_GETCHECK, 0, 0); + lRet = SendMessage(GetDlgItem(hWndDlg, IDC_CV_MAINTAINASPECT), BM_GETCHECK, 0, 0); - g_XBVideo.bHardwareYUV = (lRet == BST_CHECKED); + g_XBVideo.bMaintainAspect = (lRet == BST_CHECKED); } /*! save video configuration */ diff --git a/src/gui/resource/Cxbx.rc b/src/gui/resource/Cxbx.rc index 9f7c61b80..3b942ef25 100644 --- a/src/gui/resource/Cxbx.rc +++ b/src/gui/resource/Cxbx.rc @@ -326,7 +326,7 @@ BEGIN LTEXT "Direct3D Device:",IDC_STATIC,13,33,57,8,0,WS_EX_RIGHT LTEXT "Display Resolution:",IDC_STATIC,6,52,64,8,0,WS_EX_RIGHT LTEXT "Other Options:",IDC_STATIC,21,89,49,8,0,WS_EX_RIGHT - CONTROL "Enable Hardware YUV Overlays",IDC_CV_HARDWAREYUV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,102,123,11 + CONTROL "Maintain Aspect Ratio",IDC_CV_MAINTAINASPECT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,76,102,123,11 COMBOBOX IDC_VC_RENDER_RESOLUTION,76,68,173,100,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "Render Resolution:",IDC_STATIC,7,70,63,8,0,WS_EX_RIGHT END diff --git a/src/gui/resource/ResCxbx.h b/src/gui/resource/ResCxbx.h index 20c2c4b63..5077da17e 100644 --- a/src/gui/resource/ResCxbx.h +++ b/src/gui/resource/ResCxbx.h @@ -149,7 +149,7 @@ #define IDC_VC_RENDER_RESOLUTION 1052 #define IDC_BTN_COM3 1053 #define IDC_BTN_COM4 1054 -#define IDC_CV_HARDWAREYUV 1055 +#define IDC_CV_MAINTAINASPECT 1055 #define IDC_BTN_COM5 1056 #define IDC_BTN_FUNC1 1057 #define IDC_BTN_FUNC2 1058