diff --git a/Source/Core/VideoCommon/Src/GlobalControl.cpp b/Source/Core/VideoCommon/Src/GlobalControl.cpp index 53f29bc932..00cd8710a0 100644 --- a/Source/Core/VideoCommon/Src/GlobalControl.cpp +++ b/Source/Core/VideoCommon/Src/GlobalControl.cpp @@ -24,6 +24,7 @@ static bool g_ProjHack0; static ProjectionHack g_ProjHack1; static ProjectionHack g_ProjHack2; static bool g_FreeLook; +static bool g_Widescreen; } // Namespace @@ -47,6 +48,11 @@ void Projection_SetFreeLook(bool enabled) g_FreeLook = enabled; } +void Projection_SetWidescreen(bool enabled) +{ + g_Widescreen = enabled; +} + bool Projection_GetHack0() { return g_ProjHack0; @@ -66,3 +72,8 @@ bool Projection_GetFreeLook() { return g_FreeLook; } + +bool Projection_GetWidescreen() +{ + return g_Widescreen; +} diff --git a/Source/Core/VideoCommon/Src/GlobalControl.h b/Source/Core/VideoCommon/Src/GlobalControl.h index ad48e6c50d..3c0fc72c00 100644 --- a/Source/Core/VideoCommon/Src/GlobalControl.h +++ b/Source/Core/VideoCommon/Src/GlobalControl.h @@ -44,8 +44,10 @@ void Projection_SetHack0(bool value); void Projection_SetHack1(ProjectionHack value); void Projection_SetHack2(ProjectionHack value); void Projection_SetFreeLook(bool enabled); +void Projection_SetWidescreen(bool enabled); bool Projection_GetHack0(); ProjectionHack Projection_GetHack1(); ProjectionHack Projection_GetHack2(); bool Projection_GetFreeLook(); +bool Projection_GetWidescreen(); \ No newline at end of file diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index a742ec0a84..eaf46a3a37 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -226,8 +226,9 @@ void VertexShaderManager::SetConstants() if (xfregs.rawProjection[6] == 0) { + bool bWidescreenHack = Projection_GetWidescreen(); // Perspective - g_fProjectionMatrix[0] = xfregs.rawProjection[0]; + g_fProjectionMatrix[0] = (bWidescreenHack ? xfregs.rawProjection[0]*0.75f : xfregs.rawProjection[0]); g_fProjectionMatrix[1] = 0.0f; g_fProjectionMatrix[2] = xfregs.rawProjection[1]; g_fProjectionMatrix[3] = 0.0f; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp index 25f6837eb3..7804afd4b3 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.cpp @@ -44,6 +44,7 @@ void Config::Load() 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); iniFile.Get("Settings", "Crop", &bCrop, false); @@ -140,6 +141,7 @@ void Config::Save() iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43); iniFile.Set("Settings", "KeepAR_16_9", bKeepAR169); iniFile.Set("Settings", "Crop", bCrop); + iniFile.Set("Settings", "wideScreenHack", bWidescreenHack); iniFile.Set("Settings", "HideCursor", bHideCursor); iniFile.Set("Settings", "UseXFB", bUseXFB); iniFile.Set("Settings", "AutoScale", bAutoScale); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h index aa1d59cc4c..dbef908978 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h @@ -60,6 +60,7 @@ struct Config char iInternalRes[16]; bool bNativeResolution, b2xResolution; // Should possibly be augmented with 2x, 4x native. + bool bWidescreenHack; bool bKeepAR43, bKeepAR169, bCrop; // Aspect ratio controls. bool bUseXFB; bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly. diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp index cf8b6cd7dd..0cdbc854ac 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.cpp @@ -46,6 +46,7 @@ BEGIN_EVENT_TABLE(GFXConfigDialogOGL,wxDialog) 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) EVT_CHECKBOX(ID_AUTOSCALE, GFXConfigDialogOGL::GeneralSettingsChanged) @@ -179,6 +180,7 @@ void GFXConfigDialogOGL::CreateGUIControls() 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 *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Window mode:"), wxDefaultPosition, wxDefaultSize , 0 ); @@ -202,6 +204,7 @@ 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); @@ -250,6 +253,8 @@ void GFXConfigDialogOGL::CreateGUIControls() 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( wxT("Crop the picture instead of creating a letterbox. It will assume that your screen") wxT("\nis of the 5:4 format if you have selected the 4:3 aspect ratio. It will assume") @@ -325,9 +330,10 @@ void GFXConfigDialogOGL::CreateGUIControls() sBasic->Add(m_KeepAR43, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5); sBasic->Add(m_KeepAR169, wxGBPosition(3, 2), wxGBSpan(1, 1), wxALL, 5); 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(4, 0), wxGBSpan(1, 1), wxALL, 5); - sBasic->Add(m_Fullscreen, wxGBPosition(4, 1), 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 #ifndef _WIN32 @@ -584,6 +590,10 @@ void GFXConfigDialogOGL::GeneralSettingsChanged(wxCommandEvent& event) // 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(); + Projection_SetWidescreen(g_Config.bWidescreenHack); + break; case ID_VSYNC: g_Config.bVSync = m_VSync->IsChecked(); break; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h index 8383dd1b88..f8f5b7ea06 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GUI/ConfigDlg.h @@ -93,6 +93,7 @@ class GFXConfigDialogOGL : public wxDialog wxCheckBox *m_VSync; wxCheckBox *m_RenderToMainWindow; wxCheckBox *m_NativeResolution, *m_2xResolution; + wxCheckBox *m_WidescreenHack; wxCheckBox *m_ForceFiltering; wxCheckBox *m_KeepAR43, *m_KeepAR169, *m_Crop; wxCheckBox *m_UseXFB; @@ -150,6 +151,7 @@ class GFXConfigDialogOGL : public wxDialog ID_VSYNC, ID_RENDERTOMAINWINDOW, ID_NATIVERESOLUTION, ID_2X_RESOLUTION, + ID_WIDESCREEN_HACK, ID_KEEPAR_4_3, ID_KEEPAR_16_9, ID_CROP, ID_USEXFB, ID_AUTOSCALE,