diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 67260df724..17c8ba38c9 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -324,6 +324,7 @@ THREAD_RETURN EmuThread(void *pArg) VideoInitialize.Fifo_CPUBase = &ProcessorInterface::Fifo_CPUBase; VideoInitialize.Fifo_CPUEnd = &ProcessorInterface::Fifo_CPUEnd; VideoInitialize.Fifo_CPUWritePointer = &ProcessorInterface::Fifo_CPUWritePointer; + VideoInitialize.bAutoAspectIs16_9 = _CoreParameter.bWii ? SConfig::GetInstance().m_SYSCONF->GetData("IPL.AR") : false; Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 100176863f..614811c813 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -54,8 +54,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true); iniFile.Get("Settings", "2xResolution", &b2xResolution, false); iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false); - iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, true); - iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false); + iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); iniFile.Get("Settings", "Crop", &bCrop, false); iniFile.Get("Settings", "HideCursor", &bHideCursor, false); iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); @@ -149,8 +148,7 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Hardware", "RenderToMainframe", RenderToMainframe); iniFile.Set("Settings", "StretchToFit", bNativeResolution); iniFile.Set("Settings", "2xResolution", b2xResolution); - iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43); - iniFile.Set("Settings", "KeepAR_16_9", bKeepAR169); + iniFile.Set("Settings", "AspectRatio", iAspectRatio); iniFile.Set("Settings", "Crop", bCrop); iniFile.Set("Settings", "wideScreenHack", bWidescreenHack); iniFile.Set("Settings", "HideCursor", bHideCursor); @@ -210,10 +208,19 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip const float WinHeight = FloatGLHeight; // Handle aspect ratio. - if (g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169) + // Default to auto. + bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9; + + // Check for force-settings and override. + if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9) + use16_9 = true; + else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) + use16_9 = false; + + if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) { // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio - float Ratio = (WinWidth / WinHeight) / (g_Config.bKeepAR43 ? (4.0f / 3.0f) : (16.0f / 9.0f)); + float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); // Check if height or width is the limiting factor. If ratio > 1 the picture is too wide and have to limit the width. if (Ratio > 1.0f) { @@ -234,9 +241,9 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip // Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10. // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset // ------------------ - if ((g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169) && g_ActiveConfig.bCrop) + if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop) { - float Ratio = g_Config.bKeepAR43 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f))); + float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f))); // The width and height we will add (calculate this before FloatGLWidth and FloatGLHeight is adjusted) float IncreasedWidth = (Ratio - 1.0f) * FloatGLWidth; float IncreasedHeight = (Ratio - 1.0f) * FloatGLHeight; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index e3dd402c5f..359dc549d3 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -48,6 +48,13 @@ enum MultisampleMode { MULTISAMPLE_CSAA_16XQ, }; +enum AspectMode { + ASPECT_AUTO = 0, + ASPECT_FORCE_16_9 = 1, + ASPECT_FORCE_4_3 = 2, + ASPECT_STRETCH = 3, +}; + class IniFile; // NEVER inherit from this class. @@ -71,7 +78,8 @@ struct VideoConfig bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native. bool bWidescreenHack; - bool bKeepAR43, bKeepAR169, bCrop; // Aspect ratio controls. + int iAspectRatio; + bool bCrop; // Aspect ratio controls. bool bUseXFB; bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly. diff --git a/Source/PluginSpecs/pluginspecs_video.h b/Source/PluginSpecs/pluginspecs_video.h index a9f9977784..e7c08c423b 100644 --- a/Source/PluginSpecs/pluginspecs_video.h +++ b/Source/PluginSpecs/pluginspecs_video.h @@ -88,7 +88,7 @@ typedef struct u32 *Fifo_CPUBase; u32 *Fifo_CPUEnd; u32 *Fifo_CPUWritePointer; - + bool bAutoAspectIs16_9; } SVideoInitialize; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp index 9eb40f1b5c..c79c5dbad1 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp @@ -29,6 +29,13 @@ // TODO: remove if/when ini files use unicode #define ComboBox_GetTextA(hwndCtl, lpch, cchMax) GetWindowTextA((hwndCtl), (lpch), (cchMax)) +const char *aspect_ratio_names[4] = { + "Auto", + "Force 16:9 Widescreen", + "Force 4:3 Standard", + "Stretch to Window", +}; + struct TabDirect3D : public W32Util::Tab { void Init(HWND hDlg) @@ -39,7 +46,7 @@ struct TabDirect3D : public W32Util::Tab { const D3D::Adapter &adapter = D3D::GetAdapter(i); MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, adapter.ident.Description, -1, tempwstr, 2000); - ComboBox_AddString(GetDlgItem(hDlg,IDC_ADAPTER),tempwstr); + ComboBox_AddString(GetDlgItem(hDlg, IDC_ADAPTER),tempwstr); } const D3D::Adapter &adapter = D3D::GetAdapter(g_Config.iAdapter); @@ -57,25 +64,34 @@ struct TabDirect3D : public W32Util::Tab ComboBox_Enable(GetDlgItem(hDlg, IDC_ANTIALIASMODE), FALSE); } + for (int i = 0; i < 4; i++) + { + MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, aspect_ratio_names[i], -1, tempwstr, 2000); + ComboBox_AddString(GetDlgItem(hDlg, IDC_ASPECTRATIO), tempwstr); + } + ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_ASPECTRATIO), g_Config.iAspectRatio); + for (int i = 0; i < (int)adapter.resolutions.size(); i++) { const D3D::Resolution &r = adapter.resolutions[i]; MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, r.name, -1, tempwstr, 2000); - ComboBox_AddString(GetDlgItem(hDlg,IDC_RESOLUTION), tempwstr); - ComboBox_AddString(GetDlgItem(hDlg,IDC_RESOLUTIONWINDOWED),tempwstr); + ComboBox_AddString(GetDlgItem(hDlg, IDC_RESOLUTION), tempwstr); + ComboBox_AddString(GetDlgItem(hDlg, IDC_RESOLUTIONWINDOWED),tempwstr); } - for (int i = 0; i <16; i++) tempwstr[i] = g_Config.cFSResolution[i]; + for (int i = 0; i < 16; i++) { + tempwstr[i] = g_Config.cFSResolution[i]; + } ComboBox_SelectString(GetDlgItem(hDlg,IDC_RESOLUTION), -1, tempwstr); - for (int i = 0; i < 16; i++) tempwstr[i] = g_Config.cInternalRes[i]; + for (int i = 0; i < 16; i++) { + tempwstr[i] = g_Config.cInternalRes[i]; + } ComboBox_SelectString(GetDlgItem(hDlg,IDC_RESOLUTIONWINDOWED), -1, tempwstr); Button_SetCheck(GetDlgItem(hDlg, IDC_FULLSCREENENABLE), g_Config.bFullscreen); Button_SetCheck(GetDlgItem(hDlg, IDC_VSYNC), g_Config.bVSync); Button_SetCheck(GetDlgItem(hDlg, IDC_RENDER_TO_MAINWINDOW), g_Config.RenderToMainframe); - Button_SetCheck(GetDlgItem(hDlg, IDC_ASPECT_16_9), g_Config.bKeepAR169); - Button_SetCheck(GetDlgItem(hDlg, IDC_ASPECT_4_3), g_Config.bKeepAR43); Button_SetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK), g_Config.bWidescreenHack); Button_SetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE), g_Config.bSafeTextureCache); Button_SetCheck(GetDlgItem(hDlg, IDC_EFB_ACCESS_ENABLE), g_Config.bEFBAccessEnable); @@ -86,15 +102,8 @@ struct TabDirect3D : public W32Util::Tab { switch (LOWORD(wParam)) { - case IDC_ASPECT_4_3: - Button_SetCheck(GetDlgItem(hDlg, IDC_ASPECT_16_9), FALSE); - g_Config.bKeepAR43 = Button_GetCheck(GetDlgItem(hDlg, IDC_ASPECT_4_3)) ? true : false; - g_Config.bKeepAR169 = false; - break; - case IDC_ASPECT_16_9: - Button_SetCheck(GetDlgItem(hDlg, IDC_ASPECT_4_3), FALSE); - g_Config.bKeepAR169 = Button_GetCheck(GetDlgItem(hDlg, IDC_ASPECT_16_9)) ? true : false; - g_Config.bKeepAR43 = false; + case IDC_ASPECTRATIO: + g_Config.iAspectRatio = ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_ASPECTRATIO)); break; case IDC_WIDESCREEN_HACK: g_Config.bWidescreenHack = Button_GetCheck(GetDlgItem(hDlg, IDC_WIDESCREEN_HACK)) ? true : false; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.h b/Source/Plugins/Plugin_VideoDX9/Src/resource.h index 6bde8398fd..243c561841 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.h @@ -7,7 +7,6 @@ #define IDD_SETTINGS 103 #define IDD_ENHANCEMENTS 104 #define IDD_ADVANCED 105 - #define IDC_ADAPTER 1001 #define IDC_ANTIALIASMODE 1002 #define IDC_RESOLUTION 1003 @@ -21,13 +20,13 @@ #define IDC_SAFE_TEXTURE_CACHE 1011 #define IDC_EFB_ACCESS_ENABLE 1012 #define IDC_WIREFRAME 1013 -#define IDC_DISABLEFOG 1014 -#define IDC_OVERLAYFPS 1015 +#define IDC_DISABLEFOG 1014 +#define IDC_OVERLAYFPS 1015 #define IDC_OVERLAYSTATS 1016 #define IDC_OVERLAYPROJSTATS 1017 -#define IDC_ENABLEEFBCOPY 1018 -#define IDC_EFBTORAM 1019 -#define IDC_EFBTOTEX 1020 +#define IDC_ENABLEEFBCOPY 1018 +#define IDC_EFBTORAM 1019 +#define IDC_EFBTOTEX 1020 #define IDC_TEXDUMP 1021 #define IDC_DUMPFRAMES 1022 #define IDC_SHOWSHADERERRORS 1023 @@ -35,16 +34,16 @@ #define IDC_TEXFMT_CENTER 1025 #define IDC_FORCEFILTERING 1026 #define IDC_FORCEANISOTROPY 1027 -#define IDC_LOADHIRESTEXTURE 1028 -#define IDC_EFBSCALEDCOPY 1029 - +#define IDC_LOADHIRESTEXTURE 1028 +#define IDC_EFBSCALEDCOPY 1029 +#define IDC_COMBO2 1040 +#define IDC_ASPECTRATIO 1040 #define IDC_CHECK1 1100 #define IDC_LIST1 1101 #define IDC_DEBUGSTEP 1102 #define IDC_REGISTERS 1103 #define IDC_ENABLEDEBUGGING 1104 #define IDC_REGISTERSELECT 1105 - #define IDC_STATIC -1 // Next default values for new objects @@ -53,7 +52,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 106 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1039 +#define _APS_NEXT_CONTROL_VALUE 1041 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/Source/Plugins/Plugin_VideoDX9/Src/resource.rc b/Source/Plugins/Plugin_VideoDX9/Src/resource.rc index 16e1331697..5d6b413348 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/resource.rc +++ b/Source/Plugins/Plugin_VideoDX9/Src/resource.rc @@ -36,30 +36,27 @@ BEGIN LTEXT "Will not work correctly on older GPU:s.",IDC_STATIC,7,47,170,8 END -IDD_SETTINGS DIALOGEX 0, 0, 244, 217 +IDD_SETTINGS DIALOGEX 0, 0, 244, 183 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_BORDER | WS_SYSMENU FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "&Graphics card:",IDC_STATIC,7,9,61,8 - COMBOBOX IDC_ADAPTER,68,7,169,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_ADAPTER,68,7,169,48,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP CONTROL "&Fullscreen",IDC_FULLSCREENENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,25,56,8 CONTROL "&V-Sync",IDC_VSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,38,141,8 CONTROL "&Render to main window",IDC_RENDER_TO_MAINWINDOW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,50,141,8 - LTEXT "Full&screen resolution:",IDC_STATIC,7,98,69,8 - COMBOBOX IDC_RESOLUTION,87,98,150,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "&Windowed resolution:",IDC_STATIC,7,117,74,8 - COMBOBOX IDC_RESOLUTIONWINDOWED,87,116,150,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Rotate windowed mode 90 degrees (for &Ikaruga)",IDC_CHECK1, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_DISABLED | WS_TABSTOP,87,132,150,17 - LTEXT "&Anti-alias mode:",IDC_STATIC,7,157,61,8 - COMBOBOX IDC_ANTIALIASMODE,68,155,169,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Full&screen resolution:",IDC_STATIC,7,86,69,8 + COMBOBOX IDC_RESOLUTION,87,85,150,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Windowed resolution:",IDC_STATIC,7,106,74,8 + COMBOBOX IDC_RESOLUTIONWINDOWED,87,104,150,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "&Anti-alias mode:",IDC_STATIC,7,127,56,8 + COMBOBOX IDC_ANTIALIASMODE,68,125,169,73,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "&Aspect Ratio:",IDC_STATIC,7,66,52,8 - CONTROL "4:3",IDC_ASPECT_4_3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,66,59,11 - CONTROL "16:9",IDC_ASPECT_16_9,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,80,49,11 - CONTROL "&Widescreen Hack",IDC_WIDESCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,81,73,10 - CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,172,85,11 + CONTROL "&Widescreen Hack",IDC_WIDESCREEN_HACK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,170,66,67,10 + CONTROL "&Safe Texture Cache",IDC_SAFE_TEXTURE_CACHE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,68,143,85,11 CONTROL "&Enable CPU->EFB access (can cause slowdowns, enables pull stars in SMG and lens flare in Zeldas)",IDC_EFB_ACCESS_ENABLE, - "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,68,187,169,23 + "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,68,153,169,23 + COMBOBOX IDC_ASPECTRATIO,68,64,97,57,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_DEBUGGER DIALOGEX 0, 0, 234, 254 @@ -109,11 +106,10 @@ BEGIN "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,20,192,9 CONTROL "Enable 16x &anisotropy filtering",IDC_FORCEANISOTROPY, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,35,110,10 - CONTROL "Enable hires texture loading", IDC_LOADHIRESTEXTURE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,50,110,11 - GROUPBOX "EFB Hacks",IDC_STATIC,7,70,210,60 - CONTROL "EFB Scaled Copy",IDC_EFBSCALEDCOPY, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,80,110,12 + CONTROL "Enable hires texture loading",IDC_LOADHIRESTEXTURE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,50,110,11 + GROUPBOX "EFB Hacks",IDC_STATIC,7,70,210,60 + CONTROL "EFB Scaled Copy",IDC_EFBSCALEDCOPY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,80,110,12 END @@ -142,7 +138,7 @@ BEGIN VERTGUIDE, 81 VERTGUIDE, 87 TOPMARGIN, 7 - BOTTOMMARGIN, 210 + BOTTOMMARGIN, 176 END IDD_DEBUGGER, DIALOG @@ -193,9 +189,26 @@ BEGIN "#include SetValue(g_Config.RenderToMainframe); m_NativeResolution = new wxCheckBox(m_PageGeneral, ID_NATIVERESOLUTION, wxT("Native"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_2xResolution = new wxCheckBox(m_PageGeneral, ID_2X_RESOLUTION, wxT("2x"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - wxStaticText *IRText = new wxStaticText(m_PageGeneral, ID_IRTEXT, wxT("Resolution :"), wxDefaultPosition, wxDefaultSize, 0); - wxStaticText *RText = new wxStaticText(m_PageGeneral, ID_RTEXT, wxT("Custom resolution :"), wxDefaultPosition, wxDefaultSize, 0); - wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Windowed :"), wxDefaultPosition, wxDefaultSize , 0 ); + wxStaticText *IRText = new wxStaticText(m_PageGeneral, ID_IRTEXT, wxT("Resolution:"), wxDefaultPosition, wxDefaultSize, 0); + wxStaticText *RText = new wxStaticText(m_PageGeneral, ID_RTEXT, wxT("Custom resolution:"), wxDefaultPosition, wxDefaultSize, 0); + wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Windowed:"), wxDefaultPosition, wxDefaultSize , 0 ); m_WindowResolutionCB = new wxComboBox(m_PageGeneral, ID_WINDOWRESOLUTIONCB, arrayStringFor_WindowResolutionCB[0], wxDefaultPosition, wxDefaultSize, arrayStringFor_WindowResolutionCB, wxCB_READONLY, wxDefaultValidator); m_WindowResolutionCB->SetValue(wxString::FromAscii(g_Config.cInternalRes)); m_WindowFSResolutionCB = new wxComboBox(m_PageGeneral, ID_WINDOWFSRESOLUTIONCB, arrayStringFor_FullscreenCB[0], wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, wxCB_READONLY, wxDefaultValidator); @@ -185,27 +185,27 @@ void GFXConfigDialogOGL::CreateGUIControls() // Aspect ratio / positioning controls wxStaticText *KeepARText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Keep aspect ratio:"), wxDefaultPosition, wxDefaultSize, 0); - m_KeepAR = new wxChoice(m_PageGeneral, ID_KEEPAR, wxDefaultPosition, wxDefaultSize); - m_KeepAR->Append(wxT("Disabled")); - m_KeepAR->Append(wxT("4:3")); - m_KeepAR->Append(wxT("16:9")); - m_KeepAR->Append(wxT("WideScreen Hack")); + m_KeepAR = new wxChoice(m_PageGeneral, ID_ASPECT, wxDefaultPosition, wxDefaultSize); + m_KeepAR->Append(wxT("Auto Aspect (recommended)")); + m_KeepAR->Append(wxT("Force 16:9 Widescreen")); + m_KeepAR->Append(wxT("Force 4:3 Standard")); + m_KeepAR->Append(wxT("Stretch to Window")); m_Crop = new wxCheckBox(m_PageGeneral, ID_CROP, wxT("Crop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Fullscreen = new wxCheckBox(m_PageGeneral, ID_FULLSCREEN, wxT("Fullscreen :"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Fullscreen->SetValue(g_Config.bFullscreen); m_UseXFB = new wxCheckBox(m_PageGeneral, ID_USEXFB, wxT("Use Real XFB"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_AutoScale = new wxCheckBox(m_PageGeneral, ID_AUTOSCALE, wxT("Auto scale (try to remove borders)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + m_WidescreenHack = new wxCheckBox(m_PageGeneral, ID_WIDESCREENHACK, wxT("Wide screen hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); // Default values m_NativeResolution->SetValue(g_Config.bNativeResolution); m_2xResolution->SetValue(g_Config.b2xResolution); - if (g_Config.bKeepAR43) m_KeepAR->SetSelection(1); - else if (g_Config.bWidescreenHack) m_KeepAR->SetSelection(3); - else if (g_Config.bKeepAR169) m_KeepAR->SetSelection(2); - else m_KeepAR->SetSelection(0); + m_KeepAR->SetSelection(g_Config.iAspectRatio); + m_Crop->SetValue(g_Config.bCrop); m_UseXFB->SetValue(g_Config.bUseXFB); m_AutoScale->SetValue(g_Config.bAutoScale); + m_WidescreenHack->SetValue(g_Config.bWidescreenHack); #ifndef _WIN32 m_HideCursor = new wxCheckBox(m_PageGeneral, ID_HIDECURSOR, wxT("Hide mouse cursor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); @@ -348,6 +348,7 @@ void GFXConfigDialogOGL::CreateGUIControls() sBasicAdvanced->Add(m_VSync, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5); sBasicAdvanced->Add(m_UseXFB, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5); sBasicAdvanced->Add(m_AutoScale, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5); + sBasicAdvanced->Add(m_WidescreenHack, wxGBPosition(5, 0), wxGBSpan(1, 2), wxALL, 5); sbBasicAdvanced->Add(sBasicAdvanced); sGeneral->Add(sbBasicAdvanced, 0, wxEXPAND|wxALL, 5); @@ -598,29 +599,18 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event) case ID_AUTOSCALE: g_Config.bAutoScale = m_AutoScale->IsChecked(); break; - case ID_KEEPAR: - - g_Config.bKeepAR169 = false; - g_Config.bKeepAR43 = false; - g_Config.bWidescreenHack = false; - - if (m_KeepAR->GetSelection() == 1) // 4:3 - g_Config.bKeepAR43 = true; - else if (m_KeepAR->GetSelection() == 2) // 16:9 - g_Config.bKeepAR169 = true; - else if (m_KeepAR->GetSelection() == 3) { // WideScreen hack / 16:9 - g_Config.bKeepAR169 = true; - g_Config.bWidescreenHack = true; - } + case ID_ASPECT: + g_Config.iAspectRatio = m_KeepAR->GetSelection(); + break; + case ID_WIDESCREENHACK: + g_Config.bWidescreenHack = m_WidescreenHack->IsChecked(); break; case ID_CROP: g_Config.bCrop = m_Crop->IsChecked(); break; - case ID_FORCEFILTERING: g_Config.bForceFiltering = m_ForceFiltering->IsChecked(); break; - #ifndef _WIN32 case ID_HIDECURSOR: g_Config.bHideCursor = m_HideCursor->IsChecked(); @@ -754,7 +744,7 @@ void GFXConfigDialogOGL::CloseWindow() void GFXConfigDialogOGL::UpdateGUI() { // This is only used together with the aspect ratio options - m_Crop->Enable(g_Config.bKeepAR43 || g_Config.bKeepAR169); + m_Crop->Enable(g_Config.iAspectRatio != ASPECT_STRETCH); if (g_Config.bUseXFB) { // XFB looks much better if the copy comes from native resolution. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index 610da7092a..378fe01cbf 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -159,9 +159,11 @@ class GFXConfigDialogOGL : public wxDialog ID_VSYNC, ID_RENDERTOMAINWINDOW, ID_NATIVERESOLUTION, ID_2X_RESOLUTION, - ID_KEEPAR, ID_CROP, + ID_ASPECT, + ID_CROP, ID_USEXFB, ID_AUTOSCALE, + ID_WIDESCREENHACK, ID_HIDECURSOR, ID_FSTEXT, diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp index e6616f8d94..ae34758aad 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp @@ -110,16 +110,8 @@ void OSDMenu(WPARAM wParam) case '4': OSDChoice = 2; // Toggle aspect ratio - if (!(g_Config.bKeepAR43 || g_Config.bKeepAR169)) - { g_Config.bKeepAR43 = true; g_Config.bCrop = false; } - else if (g_Config.bKeepAR43 && !g_Config.bCrop) - g_Config.bCrop = true; - else if (g_Config.bKeepAR43) - { g_Config.bKeepAR43 = false; g_Config.bCrop = false; g_Config.bKeepAR169 = true; } - else if (g_Config.bKeepAR169 && !g_Config.bCrop) - g_Config.bCrop = true; - else - { g_Config.bKeepAR43 = false; g_Config.bKeepAR169 = false; g_Config.bCrop = false; } + g_Config.iAspectRatio++; + g_Config.iAspectRatio &= 3; break; case '5': OSDChoice = 3; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index a8aa792e82..1ec6dcbf75 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1182,8 +1182,8 @@ void Renderer::DrawDebugText() StringFromFormat("%i x %i (native)", OSDInternalW, OSDInternalH) : StringFromFormat("%i x %i (2x)", OSDInternalW, OSDInternalH)) : StringFromFormat("%i x %i (custom)", W, H); - std::string OSDM21 = - !(g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169) ? "-": (g_ActiveConfig.bKeepAR43 ? "4:3" : "16:9"); + std::string OSDM21 = ""; + // !(g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169) ? "-": (g_ActiveConfig.bKeepAR43 ? "4:3" : "16:9"); std::string OSDM22 = g_ActiveConfig.bCrop ? " (crop)" : ""; std::string OSDM31 = @@ -1256,9 +1256,17 @@ THREAD_RETURN TakeScreenshot(void *pArgs) float FloatH = (float)threadStruct->H; // Handle aspect ratio for the final ScrStrct to look exactly like what's on screen. - if (g_ActiveConfig.bKeepAR43 || g_ActiveConfig.bKeepAR169) + if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) { - float Ratio = (FloatW / FloatH) / (g_ActiveConfig.bKeepAR43 ? (4.0f / 3.0f) : (16.0f / 9.0f)); + bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9; + + // Check for force-settings and override. + if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9) + use16_9 = true; + else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) + use16_9 = false; + + float Ratio = (FloatW / FloatH) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); // If ratio > 1 the picture is too wide and we have to limit the width. if (Ratio > 1)