diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index 5172a048a9..83b39ea0d9 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -25,6 +25,7 @@ Config g_Config; Config::Config() { + bAllow2xResolution = true; } void Config::Load() @@ -43,6 +44,7 @@ void Config::Load() iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false); 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, false); iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false); @@ -136,6 +138,7 @@ void Config::Save() iniFile.Set("Hardware", "VSync", bVSync); 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", "Crop", bCrop); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index 59d75025b0..09614165e0 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -59,7 +59,7 @@ struct Config char iFSResolution[16]; char iInternalRes[16]; - bool bNativeResolution; // Should possibly be augmented with 2x, 4x native. + bool bNativeResolution, b2xResolution, bAllow2xResolution; // Should possibly be augmented with 2x, 4x native. bool bWidescreenHack; bool bKeepAR43, bKeepAR169, bCrop; // Aspect ratio controls. bool bUseXFB; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index 73fb70ff52..4e56c07916 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -45,6 +45,7 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog) EVT_CHOICE(ID_MAXANISOTROPY, GFXConfigDialogOGL::GeneralSettingsChanged) EVT_CHOICE(ID_MSAAMODECB, GFXConfigDialogOGL::GeneralSettingsChanged) EVT_CHECKBOX(ID_NATIVERESOLUTION, GFXConfigDialogOGL::GeneralSettingsChanged) + EVT_CHECKBOX(ID_2X_RESOLUTION, GFXConfigDialogOGL::GeneralSettingsChanged) EVT_CHECKBOX(ID_WIDESCREEN_HACK, GFXConfigDialogOGL::GeneralSettingsChanged) EVT_CHECKBOX(ID_USEXFB, GFXConfigDialogOGL::GeneralSettingsChanged) EVT_CHECKBOX(ID_FORCEFILTERING, GFXConfigDialogOGL::GeneralSettingsChanged) @@ -178,9 +179,10 @@ void GFXConfigDialogOGL::CreateGUIControls() m_RenderToMainWindow = new wxCheckBox(m_PageGeneral, ID_RENDERTOMAINWINDOW, wxT("Render to main window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_RenderToMainWindow->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); m_WidescreenHack = new wxCheckBox(m_PageGeneral, ID_WIDESCREEN_HACK, wxT("Wide Screen Hack"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - wxStaticText *IRText = new wxStaticText(m_PageGeneral, ID_IRTEXT, wxT("Internal resolution Settings:"), wxDefaultPosition, wxDefaultSize, 0); - wxStaticText *RText = new wxStaticText(m_PageGeneral, ID_RTEXT, wxT("Resolution Settings:"), wxDefaultPosition, wxDefaultSize, 0); + wxStaticText *IRText = new wxStaticText(m_PageGeneral, ID_IRTEXT, wxT("Native 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("Window mode:"), wxDefaultPosition, wxDefaultSize , 0 ); wxStaticText *WM2Text = new wxStaticText(m_PageGeneral, ID_WM2TEXT, wxT("Window mode:"), wxDefaultPosition, wxDefaultSize , 0 ); wxStaticText *FMText = new wxStaticText(m_PageGeneral, ID_FMTEXT, wxT("Fullscreen mode:"), wxDefaultPosition, wxDefaultSize , 0 ); @@ -201,12 +203,15 @@ void GFXConfigDialogOGL::CreateGUIControls() // Default values m_NativeResolution->SetValue(g_Config.bNativeResolution); + m_2xResolution->SetValue(g_Config.b2xResolution); m_WidescreenHack->SetValue(g_Config.bWidescreenHack); m_KeepAR43->SetValue(g_Config.bKeepAR43); m_KeepAR169->SetValue(g_Config.bKeepAR169); m_Crop->SetValue(g_Config.bCrop); m_UseXFB->SetValue(g_Config.bUseXFB); m_AutoScale->SetValue(g_Config.bAutoScale); + // Enabled + m_2xResolution->Enable(g_Config.bAllow2xResolution); #ifndef _WIN32 m_HideCursor = new wxCheckBox(m_PageGeneral, ID_HIDECURSOR, wxT("Hide mouse cursor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); @@ -248,6 +253,8 @@ void GFXConfigDialogOGL::CreateGUIControls() wxT("\nmay result in a blurrier image, but it may also give a higher") wxT("\nFPS if you have a slow graphics card.") wxT("\n\nApplies instanty during gameplay: ")); + m_2xResolution->SetToolTip(wxT( + "Applies instanty during gameplay: ")); m_WidescreenHack->SetToolTip(wxT( "Applies instanty during gameplay: ")); m_Crop->SetToolTip( @@ -313,6 +320,7 @@ void GFXConfigDialogOGL::CreateGUIControls() sBasic->Add(IRText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5); sBasic->Add(m_NativeResolution, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5); + sBasic->Add(m_2xResolution, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5); sBasic->Add(RText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5); sBasic->Add(WMText, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -326,7 +334,7 @@ void GFXConfigDialogOGL::CreateGUIControls() sBasic->Add(m_Crop, wxGBPosition(3, 3), wxGBSpan(1, 1), wxALL, 5); sBasic->Add(m_WidescreenHack, wxGBPosition(4, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5); - sBasic->Add(WM2Text, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5); + sBasic->Add(WM2Text, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5); sBasic->Add(m_Fullscreen, wxGBPosition(5, 1), wxGBSpan(1, 1), wxALL, 5); // This option is configured from the main Dolphin.exe settings for _WIN32 @@ -576,6 +584,13 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event) break; case ID_NATIVERESOLUTION: g_Config.bNativeResolution = m_NativeResolution->IsChecked(); + // Don't allow 1x and 2x at the same time + if (g_Config.bNativeResolution) { g_Config.b2xResolution = false; m_2xResolution->SetValue(false); } + break; + case ID_2X_RESOLUTION: + g_Config.b2xResolution = m_2xResolution->IsChecked(); + // Don't allow 1x and 2x at the same time + if (g_Config.b2xResolution) { g_Config.bNativeResolution = false; m_NativeResolution->SetValue(false); } break; case ID_WIDESCREEN_HACK: g_Config.bWidescreenHack = m_WidescreenHack->IsChecked(); @@ -758,12 +773,13 @@ void GFXConfigDialogOGL::UpdateGUI() if (g_Config.renderToMainframe) m_Fullscreen->SetValue(false); // Disable the internal resolution option if it's set to native - m_WindowResolutionCB->Enable(!(g_Config.bNativeResolution)); - m_WindowFSResolutionCB->Enable(!(g_Config.bNativeResolution)); + m_WindowResolutionCB->Enable(!(g_Config.bNativeResolution || g_Config.b2xResolution)); + m_WindowFSResolutionCB->Enable(!(g_Config.bNativeResolution || g_Config.b2xResolution)); //Disable the Copy to options when EFBCopy is disabled m_Radio_CopyEFBToRAM->Enable(!(g_Config.bEFBCopyDisable)); m_Radio_CopyEFBToGL->Enable(!(g_Config.bEFBCopyDisable)); + } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index 0e24b6b690..f8f5b7ea06 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -92,7 +92,7 @@ class GFXConfigDialogOGL : public wxDialog wxCheckBox *m_Fullscreen; wxCheckBox *m_VSync; wxCheckBox *m_RenderToMainWindow; - wxCheckBox *m_NativeResolution; + wxCheckBox *m_NativeResolution, *m_2xResolution; wxCheckBox *m_WidescreenHack; wxCheckBox *m_ForceFiltering; wxCheckBox *m_KeepAR43, *m_KeepAR169, *m_Crop; @@ -150,7 +150,7 @@ class GFXConfigDialogOGL : public wxDialog ID_FULLSCREEN, ID_VSYNC, ID_RENDERTOMAINWINDOW, - ID_NATIVERESOLUTION, + ID_NATIVERESOLUTION, ID_2X_RESOLUTION, ID_WIDESCREEN_HACK, ID_KEEPAR_4_3, ID_KEEPAR_16_9, ID_CROP, ID_USEXFB, diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp index 15c946aed7..67dfc72ba6 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp @@ -98,7 +98,12 @@ void OSDMenu(WPARAM wParam) case '3': OSDChoice = 1; // Toggle native resolution - g_Config.bNativeResolution = !g_Config.bNativeResolution; + if (!(g_Config.bNativeResolution || g_Config.b2xResolution)) + g_Config.bNativeResolution = true; + else if (g_Config.bNativeResolution && g_Config.bAllow2xResolution) + { g_Config.bNativeResolution = false; g_Config.b2xResolution = true; } + else + g_Config.b2xResolution = false; break; case '4': OSDChoice = 2; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index e5a101ce57..73df12ab92 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -288,31 +288,40 @@ bool Renderer::Init() WARN_LOG(VIDEO, "ARB_texture_non_power_of_two not supported. This extension is not yet used, though."); } + // Decide frambuffer size + // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ + int W = (int)OpenGL_GetBackbufferWidth(), H = (int)OpenGL_GetBackbufferHeight(); if (g_Config.bNativeResolution) { s_targetwidth = EFB_WIDTH; s_targetheight = EFB_HEIGHT; } + else if (g_Config.b2xResolution) + { + s_targetwidth = 2 * EFB_WIDTH; + s_targetheight = 2 * EFB_HEIGHT; + } else { // The size of the framebuffer targets should really NOT be the size of the OpenGL viewport. // The EFB is larger than 640x480 - in fact, it's 640x528, give or take a couple of lines. // So the below is wrong. // This should really be grabbed from config rather than from OpenGL. - int W = (int)OpenGL_GetBackbufferWidth(), H = (int)OpenGL_GetBackbufferHeight(); - s_targetwidth = (W < 640) ? 640 : W; - s_targetheight = (H < 480) ? 480 : H; + s_targetwidth = (640 >= W) ? 640 : W; + s_targetheight = (480 >= H) ? 480 : H; // Compensate height of render target for scaling, so that we get something close to the correct number of // vertical pixels. s_targetheight *= 528.0 / 480.0; + + // Ensure a minimum target size so that the native res target always fits. + if (s_targetwidth < EFB_WIDTH) s_targetwidth = EFB_WIDTH; + if (s_targetheight < EFB_HEIGHT) s_targetheight = EFB_HEIGHT; } - // Ensure a minimum target size so that the native res target always fits. - if (s_targetwidth < EFB_WIDTH) - s_targetwidth = EFB_WIDTH; - if (s_targetheight < EFB_HEIGHT) - s_targetheight = EFB_HEIGHT; + // Disable the 2x option + if (!g_Config.b2xResolution && (W < 1280 || H < 960)) g_Config.bAllow2xResolution = false; + // ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ if (GL_REPORT_ERROR() != GL_NO_ERROR) bSuccess = false; @@ -400,6 +409,7 @@ bool Renderer::Init() void Renderer::Shutdown(void) { + g_Config.bAllow2xResolution = true; delete s_pfont; s_pfont = 0; @@ -1231,8 +1241,10 @@ void Renderer::DrawDebugText() sscanf(g_Config.iInternalRes, "%dx%d", &W, &H); std::string OSDM1 = - g_Config.bNativeResolution ? + g_Config.bNativeResolution || g_Config.b2xResolution ? + (g_Config.bNativeResolution ? 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_Config.bKeepAR43 || g_Config.bKeepAR169) ? "-": (g_Config.bKeepAR43 ? "4:3" : "16:9");