OpenGL: Added keep 16:9 aspect ratio, if anyone is displeased with the stretching to 16:10, and would rather want a letterbox

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2418 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-02-24 19:16:08 +00:00
parent 1f0f0f4295
commit 354f1e5f44
7 changed files with 33 additions and 19 deletions

View File

@ -59,7 +59,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Dolphin", "Core\DolphinWX\D
{48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} {48AD7E0A-25B1-4974-A1E3-03F8C438D34F} = {48AD7E0A-25B1-4974-A1E3-03F8C438D34F}
{CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160} = {CFDCEE0E-FA45-4F72-9FCC-0B88F5A75160}
{0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0} {0318BA30-EF48-441A-9E10-DC85EFAE39F0} = {0318BA30-EF48-441A-9E10-DC85EFAE39F0}
{8D612734-FAA5-4B8A-804F-4DEA2367D495} = {8D612734-FAA5-4B8A-804F-4DEA2367D495}
{71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C} {71B16F46-0B00-4EDA-B253-D6D9D03A215C} = {71B16F46-0B00-4EDA-B253-D6D9D03A215C}
{33546D62-7F34-4EA6-A88E-D538B36E16BF} = {33546D62-7F34-4EA6-A88E-D538B36E16BF} {33546D62-7F34-4EA6-A88E-D538B36E16BF} = {33546D62-7F34-4EA6-A88E-D538B36E16BF}
{3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63} {3E03C179-8251-46E4-81F4-466F114BAC63} = {3E03C179-8251-46E4-81F4-466F114BAC63}
@ -373,7 +372,6 @@ Global
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.ActiveCfg = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.ActiveCfg = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.Build.0 = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release JITIL|x64.Build.0 = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.ActiveCfg = Release|Win32 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.ActiveCfg = Release|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|Win32.Build.0 = Release|Win32
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.ActiveCfg = Release|x64
{8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64 {8D612734-FAA5-4B8A-804F-4DEA2367D495}.Release|x64.Build.0 = Release|x64
{ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32 {ADF64291-57ED-4B7A-AB76-37B4A991504B}.Debug|Win32.ActiveCfg = Debug|Win32

View File

@ -46,7 +46,8 @@ void Config::Load()
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false); iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false);
iniFile.Get("Settings", "StretchToFit", &bStretchToFit, true); iniFile.Get("Settings", "StretchToFit", &bStretchToFit, true);
iniFile.Get("Settings", "KeepAR", &bKeepAR, false); iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false);
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);
iniFile.Get("Settings", "HideCursor", &bHideCursor, false); iniFile.Get("Settings", "HideCursor", &bHideCursor, false);
@ -96,7 +97,8 @@ void Config::Save()
iniFile.Set("Hardware", "Fullscreen", bFullscreen); iniFile.Set("Hardware", "Fullscreen", bFullscreen);
iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe); iniFile.Set("Hardware", "RenderToMainframe", renderToMainframe);
iniFile.Set("Settings", "StretchToFit", bStretchToFit); iniFile.Set("Settings", "StretchToFit", bStretchToFit);
iniFile.Set("Settings", "KeepAR", bKeepAR); iniFile.Set("Settings", "KeepAR_4_3", bKeepAR43);
iniFile.Set("Settings", "KeepAR_16_9", bKeepAR169);
iniFile.Set("Settings", "HideCursor", bHideCursor); iniFile.Set("Settings", "HideCursor", bHideCursor);
iniFile.Set("Settings", "Backend", iBackend); iniFile.Set("Settings", "Backend", iBackend);

View File

@ -41,7 +41,7 @@ struct Config
// stretch to fit should be split into two options, I think - one for low resolution backbuffer, // stretch to fit should be split into two options, I think - one for low resolution backbuffer,
// one for ignore aspect ratio. I guess KeepAR sort of does that. Anyway, these should be rethought. // one for ignore aspect ratio. I guess KeepAR sort of does that. Anyway, these should be rethought.
bool bStretchToFit; bool bStretchToFit;
bool bKeepAR; bool bKeepAR43, bKeepAR169;
bool bHideCursor; bool bHideCursor;
bool bSafeTextureCache; bool bSafeTextureCache;

View File

@ -130,7 +130,7 @@ public:
&currWinRes.x, &currWinRes.y); &currWinRes.x, &currWinRes.y);
SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen); SetProperty(OGL_FULLSCREEN, g_Config.bFullscreen);
SetProperty(OGL_KEEPRATIO, g_Config.bKeepAR); SetProperty(OGL_KEEPRATIO, g_Config.bKeepAR43);
SetProperty(OGL_HIDECURSOR, g_Config.bHideCursor); SetProperty(OGL_HIDECURSOR, g_Config.bHideCursor);
updateDim(); updateDim();

View File

@ -35,7 +35,8 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
EVT_CHOICE(ID_MAXANISOTROPY, ConfigDialog::GeneralSettingsChanged) EVT_CHOICE(ID_MAXANISOTROPY, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_FORCEFILTERING, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_FORCEFILTERING, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_STRETCHTOFIT, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_STRETCHTOFIT, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_KEEPAR, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_KEEPAR_4_3, ConfigDialog::GeneralSettingsChanged)
EVT_CHECKBOX(ID_KEEPAR_16_9, ConfigDialog::GeneralSettingsChanged)
#ifndef _WIN32 #ifndef _WIN32
EVT_CHECKBOX(ID_HIDECURSOR, ConfigDialog::GeneralSettingsChanged) EVT_CHECKBOX(ID_HIDECURSOR, ConfigDialog::GeneralSettingsChanged)
#endif #endif
@ -166,9 +167,13 @@ void ConfigDialog::CreateGUIControls()
m_RenderToMainWindow = new wxCheckBox(m_PageGeneral, ID_RENDERTOMAINWINDOW, wxT("Render to main window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_RenderToMainWindow = new wxCheckBox(m_PageGeneral, ID_RENDERTOMAINWINDOW, wxT("Render to main window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_RenderToMainWindow->SetValue(g_Config.renderToMainframe); m_RenderToMainWindow->SetValue(g_Config.renderToMainframe);
m_StretchToFit = new wxCheckBox(m_PageGeneral, ID_STRETCHTOFIT, wxT("Stretch to fit"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_StretchToFit = new wxCheckBox(m_PageGeneral, ID_STRETCHTOFIT, wxT("Stretch to fit"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_KeepAR43 = new wxCheckBox(m_PageGeneral, ID_KEEPAR_4_3, wxT("Keep 4:3 aspect ratio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_KeepAR169 = new wxCheckBox(m_PageGeneral, ID_KEEPAR_16_9, wxT("Keep 16:9 aspect ratio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Default values
m_StretchToFit->SetValue(g_Config.bStretchToFit); m_StretchToFit->SetValue(g_Config.bStretchToFit);
m_KeepAR = new wxCheckBox(m_PageGeneral, ID_KEEPAR, wxT("Keep 4:3 aspect ratio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_KeepAR43->SetValue(g_Config.bKeepAR43);
m_KeepAR->SetValue(g_Config.bKeepAR); m_KeepAR169->SetValue(g_Config.bKeepAR169);
#ifndef _WIN32 #ifndef _WIN32
m_HideCursor = new wxCheckBox(m_PageGeneral, ID_HIDECURSOR, wxT("Hide mouse cursor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_HideCursor = new wxCheckBox(m_PageGeneral, ID_HIDECURSOR, wxT("Hide mouse cursor"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -231,7 +236,8 @@ void ConfigDialog::CreateGUIControls()
sBasic->Add(m_Fullscreen, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5); sBasic->Add(m_Fullscreen, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
sBasic->Add(m_RenderToMainWindow, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5); sBasic->Add(m_RenderToMainWindow, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
sBasic->Add(m_StretchToFit, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5); sBasic->Add(m_StretchToFit, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5);
sBasic->Add(m_KeepAR, wxGBPosition(3, 0), wxGBSpan(1, 2), wxALL, 5); sBasic->Add(m_KeepAR43, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_KeepAR169, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5);
#ifndef _WIN32 #ifndef _WIN32
sBasic->Add(m_HideCursor, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5); sBasic->Add(m_HideCursor, wxGBPosition(4, 0), wxGBSpan(1, 2), wxALL, 5);
sBasic->Add(FSText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sBasic->Add(FSText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
@ -424,8 +430,15 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
case ID_STRETCHTOFIT: case ID_STRETCHTOFIT:
g_Config.bStretchToFit = m_StretchToFit->IsChecked(); g_Config.bStretchToFit = m_StretchToFit->IsChecked();
break; break;
case ID_KEEPAR: case ID_KEEPAR_4_3:
g_Config.bKeepAR = m_KeepAR->IsChecked(); g_Config.bKeepAR43 = m_KeepAR43->IsChecked();
// Don't allow both at the same time
if (g_Config.bKeepAR43) { g_Config.bKeepAR169 = false; m_KeepAR169->SetValue(false); }
break;
case ID_KEEPAR_16_9:
g_Config.bKeepAR169 = m_KeepAR169->IsChecked();
// Don't allow both at the same time
if (g_Config.bKeepAR169) { g_Config.bKeepAR43 = false; m_KeepAR43->SetValue(false); }
break; break;
#ifndef _WIN32 #ifndef _WIN32
case ID_HIDECURSOR: case ID_HIDECURSOR:
@ -544,7 +557,8 @@ void ConfigDialog::TexturePathChange(wxFileDirPickerEvent& event)
void ConfigDialog::UpdateGUI() void ConfigDialog::UpdateGUI()
{ {
// This option is only compatible with the Strech To Fit option // This option is only compatible with the Strech To Fit option
m_KeepAR->Enable(g_Config.bStretchToFit); m_KeepAR43->Enable(g_Config.bStretchToFit);
m_KeepAR169->Enable(g_Config.bStretchToFit);
// These options are for the separate rendering window // These options are for the separate rendering window
m_Fullscreen->Enable(!g_Config.renderToMainframe); m_Fullscreen->Enable(!g_Config.renderToMainframe);

View File

@ -78,7 +78,7 @@ class ConfigDialog : public wxDialog
wxCheckBox *m_Fullscreen; wxCheckBox *m_Fullscreen;
wxCheckBox *m_RenderToMainWindow; wxCheckBox *m_RenderToMainWindow;
wxCheckBox *m_StretchToFit; wxCheckBox *m_StretchToFit;
wxCheckBox *m_KeepAR; wxCheckBox *m_KeepAR43, *m_KeepAR169;
#ifndef _WIN32 #ifndef _WIN32
wxCheckBox *m_HideCursor; wxCheckBox *m_HideCursor;
#endif #endif
@ -129,7 +129,7 @@ class ConfigDialog : public wxDialog
ID_FULLSCREEN, ID_FULLSCREEN,
ID_RENDERTOMAINWINDOW, ID_RENDERTOMAINWINDOW,
ID_STRETCHTOFIT, ID_STRETCHTOFIT,
ID_KEEPAR, ID_KEEPAR_4_3, ID_KEEPAR_16_9,
ID_HIDECURSOR, ID_HIDECURSOR,
ID_FSTEXT, ID_FSTEXT,
ID_FULLSCREENCB, ID_FULLSCREENCB,

View File

@ -851,14 +851,14 @@ void Renderer::Swap(const TRectangle& rc)
// The rendering window size // The rendering window size
float WinWidth = (float)OpenGL_GetWidth(); float WinWidth = (float)OpenGL_GetWidth();
float WinHeight = (float)OpenGL_GetHeight(); float WinHeight = (float)OpenGL_GetHeight();
// The rendering window aspect ratio as a fraction of the 4:3 ratio // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio
float Ratio = WinWidth / WinHeight / (4.0f / 3.0f); float Ratio = WinWidth / WinHeight / (g_Config.bKeepAR43 ? (4.0f / 3.0f) : (16.0f / 9.0f));
float wAdj, hAdj; float wAdj, hAdj;
// Actual pixel size of the picture after adjustment // Actual pixel size of the picture after adjustment
float PictureWidth = WinWidth, PictureHeight = WinHeight; float PictureWidth = WinWidth, PictureHeight = WinHeight;
// This function currently only works together with the Stretch To Fit option // This function currently only works together with the Stretch To Fit option
if (g_Config.bKeepAR && g_Config.bStretchToFit) if ((g_Config.bKeepAR43 || g_Config.bKeepAR169) && g_Config.bStretchToFit)
{ {
// Check if height or width is the limiting factor. If ratio > 1 the picture is to wide and have to limit the width. // Check if height or width is the limiting factor. If ratio > 1 the picture is to wide and have to limit the width.
if (Ratio > 1) if (Ratio > 1)
@ -992,7 +992,7 @@ void Renderer::Swap(const TRectangle& rc)
has been filled with either for example white, or have copies of old renderings on it. So we replace has been filled with either for example white, or have copies of old renderings on it. So we replace
that with blacknes. */ that with blacknes. */
// -------------------- // --------------------
if(g_Config.bKeepAR) if(g_Config.bKeepAR43)
{ {
// Set current drawing color to red // Set current drawing color to red
glColor3f(0.0, 0.0, 0.0); // Black glColor3f(0.0, 0.0, 0.0); // Black