Allow users to disable aspect ratio correction

This replaces the unused 'Hardware YUV overlay' option in the video settings.
This commit is contained in:
Luke Usher 2020-10-01 08:52:24 +01:00
parent ea7007090c
commit ecc6669158
7 changed files with 14 additions and 20 deletions

View File

@ -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 ===========

View File

@ -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 };

View File

@ -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);

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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