mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
OpenGL: Added option to adjust the screen size and position. I need this to calibrate the Wiimote.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2307 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -85,6 +85,11 @@ void Config::Load()
|
||||
iniFile.Get("Hacks", "ProjectionHax1", &bProjectionHax1, 0);
|
||||
iniFile.Get("Hacks", "ProjectionHax2", &bProjectionHax2, 0);
|
||||
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToRAM, 0);
|
||||
iniFile.Get("Hacks", "ScreenSize", &bScreenSize, false);
|
||||
iniFile.Get("Hacks", "ScreenWidth", &iScreenWidth, 1000);
|
||||
iniFile.Get("Hacks", "ScreenHeight", &iScreenHeight, 1000);
|
||||
iniFile.Get("Hacks", "ScreenLeft", &iScreenLeft, 0);
|
||||
iniFile.Get("Hacks", "ScreenTop", &iScreenTop, 0);
|
||||
}
|
||||
|
||||
void Config::Save()
|
||||
@ -126,6 +131,11 @@ void Config::Save()
|
||||
iniFile.Set("Hacks", "ProjectionHax1", bProjectionHax1);
|
||||
iniFile.Set("Hacks", "ProjectionHax2", bProjectionHax2);
|
||||
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToRAM);
|
||||
|
||||
iniFile.Set("Hacks", "ScreenSize", bScreenSize);
|
||||
iniFile.Set("Hacks", "ScreenWidth", iScreenWidth);
|
||||
iniFile.Set("Hacks", "ScreenHeight", iScreenHeight);
|
||||
iniFile.Set("Hacks", "ScreenLeft", iScreenLeft);
|
||||
iniFile.Set("Hacks", "ScreenTop", iScreenTop);
|
||||
|
||||
iniFile.Save(FULL_CONFIG_DIR "gfx_opengl.ini");
|
||||
}
|
||||
|
@ -71,6 +71,10 @@ struct Config
|
||||
bool bProjectionHax1;
|
||||
bool bProjectionHax2;
|
||||
bool bCopyEFBToRAM;
|
||||
|
||||
// Screen size
|
||||
int iScreenWidth, iScreenHeight, iScreenLeft, iScreenTop;
|
||||
bool bScreenSize;
|
||||
|
||||
int iLog; // CONF_ bits
|
||||
int iSaveTargetId;
|
||||
|
@ -54,6 +54,14 @@ BEGIN_EVENT_TABLE(ConfigDialog,wxDialog)
|
||||
EVT_CHECKBOX(ID_EFBCOPYDISABLEHOTKEY, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PROJECTIONHACK1,ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_PROJECTIONHACK2,ConfigDialog::AdvancedSettingsChanged)
|
||||
|
||||
// Screen size
|
||||
EVT_COMMAND_SCROLL(IDS_WIDTH, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_COMMAND_SCROLL(IDS_HEIGHT, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_COMMAND_SCROLL(IDS_LEFT, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_COMMAND_SCROLL(IDS_TOP, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(IDC_SCREEN_SIZE, ConfigDialog::AdvancedSettingsChanged)
|
||||
|
||||
EVT_CHECKBOX(ID_SAFETEXTURECACHE,ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_CHECKBOX(ID_CHECKBOX_DISABLECOPYEFB, ConfigDialog::AdvancedSettingsChanged)
|
||||
EVT_DIRPICKER_CHANGED(ID_TEXTUREPATH, ConfigDialog::TexturePathChange)
|
||||
@ -252,26 +260,92 @@ void ConfigDialog::CreateGUIControls()
|
||||
m_TexturePath->SetPath(wxString::FromAscii(g_Config.texDumpPath));
|
||||
m_TexturePath->Enable(m_DumpTextures->IsChecked());
|
||||
|
||||
// Hacks
|
||||
sbHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
|
||||
|
||||
// Hacks controls
|
||||
m_SafeTextureCache = new wxCheckBox(m_PageAdvanced, ID_SAFETEXTURECACHE, wxT("Use Safe texture cache"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ProjectionHax1 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK1, wxT("Projection before R945"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ProjectionHax2 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK2, wxT("Projection hack of R844"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Disabled or enabled
|
||||
m_SafeTextureCache->Enable(true);
|
||||
m_ProjectionHax1->Enable(true);
|
||||
m_ProjectionHax2->Enable(true);
|
||||
|
||||
// Default values
|
||||
m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache);
|
||||
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
|
||||
m_ProjectionHax2->SetValue(g_Config.bProjectionHax2);
|
||||
|
||||
// Tool tips
|
||||
m_SafeTextureCache->SetToolTip(wxT("This is useful to prevent Metroid Prime from crashing, but can cause problems in other games."
|
||||
" [This option will apply immediately and does not require a restart. However it may not"
|
||||
" be entirely safe to change it midgames.]"));
|
||||
m_SafeTextureCache->Enable(true);
|
||||
m_SafeTextureCache->SetValue(g_Config.bSafeTextureCache);
|
||||
|
||||
m_ProjectionHax1 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK1, wxT("Projection before R945"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ProjectionHax1->SetToolTip(wxT("This may reveal otherwise invisible graphics"
|
||||
" in\ngames like Mario Galaxy or Ikaruga."));
|
||||
m_ProjectionHax1->Enable(true);
|
||||
m_ProjectionHax1->SetValue(g_Config.bProjectionHax1);
|
||||
|
||||
m_ProjectionHax2 = new wxCheckBox(m_PageAdvanced, ID_PROJECTIONHACK2, wxT("Projection hack of R844"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
m_ProjectionHax2->Enable(true);
|
||||
m_ProjectionHax2->SetValue(g_Config.bProjectionHax2);
|
||||
// Sizers
|
||||
sHacks = new wxGridBagSizer(0, 0);
|
||||
sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sHacks->Add(m_ProjectionHax2, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sHacks->Add(m_SafeTextureCache, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
|
||||
sbHacks = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Hacks"));
|
||||
sbHacks->Add(sHacks);
|
||||
|
||||
|
||||
// -----------------------------------------------
|
||||
// Screen size
|
||||
// ---------------------
|
||||
// Controls
|
||||
m_TextScreenWidth = new wxStaticText(m_PageAdvanced, wxID_ANY, wxT("Width: 000"));
|
||||
m_TextScreenHeight = new wxStaticText(m_PageAdvanced, wxID_ANY, wxT("Height: 000"));
|
||||
m_TextScreenLeft = new wxStaticText(m_PageAdvanced, wxID_ANY, wxT("Left: -000"));
|
||||
m_TextScreenTop = new wxStaticText(m_PageAdvanced, wxID_ANY, wxT("Top: -000"));
|
||||
|
||||
m_SliderWidth = new wxSlider(m_PageAdvanced, IDS_WIDTH, 100, 50, 150, wxDefaultPosition, wxSize(75, -1));
|
||||
m_SliderHeight = new wxSlider(m_PageAdvanced, IDS_HEIGHT, 100, 50, 150, wxDefaultPosition, wxSize(75, -1));
|
||||
m_SliderLeft = new wxSlider(m_PageAdvanced, IDS_LEFT, 0, -100, 100, wxDefaultPosition, wxSize(75, -1));
|
||||
m_SliderTop = new wxSlider(m_PageAdvanced, IDS_TOP, 0, -100, 100, wxDefaultPosition, wxSize(75, -1));
|
||||
m_ScreenSize = new wxCheckBox(m_PageAdvanced, IDC_SCREEN_SIZE, wxT("Adjust screen size and position"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
|
||||
// Default values
|
||||
m_SliderWidth->SetValue(g_Config.iScreenWidth);
|
||||
m_SliderHeight->SetValue(g_Config.iScreenHeight);
|
||||
m_SliderLeft->SetValue(g_Config.iScreenLeft);
|
||||
m_SliderTop->SetValue(g_Config.iScreenTop);
|
||||
m_ScreenSize->SetValue(g_Config.bScreenSize);
|
||||
|
||||
// Sizers
|
||||
wxBoxSizer *m_SizerScreenSizeWidth = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerScreenSizeWidth->Add(m_TextScreenWidth, 0, wxEXPAND | (wxTOP), 3);
|
||||
m_SizerScreenSizeWidth->Add(m_SliderWidth, 0, wxEXPAND | (wxLEFT), 0);
|
||||
m_SizerScreenSizeWidth->Add(m_TextScreenLeft, 0, wxEXPAND | (wxLEFT), 5);
|
||||
m_SizerScreenSizeWidth->Add(m_SliderLeft, 0, wxEXPAND | (wxLEFT), 0);
|
||||
|
||||
wxBoxSizer *m_SizerScreenSizeHeight = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerScreenSizeHeight->Add(m_TextScreenHeight, 0, wxEXPAND | (wxTOP), 3);
|
||||
m_SizerScreenSizeHeight->Add(m_SliderHeight, 0, wxEXPAND | (wxLEFT), 0);
|
||||
m_SizerScreenSizeHeight->Add(m_TextScreenTop, 0, wxEXPAND | (wxLEFT), 5);
|
||||
m_SizerScreenSizeHeight->Add(m_SliderTop, 0, wxEXPAND | (wxLEFT), 0);
|
||||
|
||||
wxStaticBoxSizer * m_SizerScreenSize = new wxStaticBoxSizer(wxVERTICAL, m_PageAdvanced, wxT("Screen size and position"));
|
||||
m_SizerScreenSize->Add(m_ScreenSize, 0, wxEXPAND | (wxALL), 5);
|
||||
m_SizerScreenSize->Add(m_SizerScreenSizeWidth, 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
m_SizerScreenSize->Add(m_SizerScreenSizeHeight, 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
|
||||
// Tool tips
|
||||
m_ScreenSize->SetToolTip(wxT(
|
||||
"Use the adjusted screen size."));
|
||||
// -------------------------------
|
||||
|
||||
// -----------------------------------------------
|
||||
// Row 4: Hacks and Screen size
|
||||
// ---------------------
|
||||
wxBoxSizer *m_SizerHacksScreenSize = new wxBoxSizer(wxHORIZONTAL);
|
||||
m_SizerHacksScreenSize->Add(sbHacks, 0, wxEXPAND | (wxTOP), 0);
|
||||
m_SizerHacksScreenSize->Add(m_SizerScreenSize, 0, wxEXPAND | (wxLEFT), 7);
|
||||
// -------------------------------
|
||||
|
||||
// Sizers
|
||||
sAdvanced = new wxBoxSizer(wxVERTICAL);
|
||||
sInfo = new wxGridBagSizer(0, 0);
|
||||
sInfo->Add(m_ShowFPS, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
@ -282,8 +356,7 @@ void ConfigDialog::CreateGUIControls()
|
||||
sInfo->Add(m_TexFmtOverlay, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sInfo->Add(m_TexFmtCenter, wxGBPosition(5, 1), wxGBSpan(1, 1), wxALL, 5);
|
||||
sbInfo->Add(sInfo);
|
||||
sAdvanced->Add(sbInfo, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
|
||||
wxBoxSizer *sRenderBoxRow1 = new wxBoxSizer(wxHORIZONTAL);
|
||||
sRendering = new wxGridBagSizer(0, 0);
|
||||
sRendering->Add(m_UseXFB, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
@ -300,25 +373,24 @@ void ConfigDialog::CreateGUIControls()
|
||||
sSBox->Add(m_Radio_CopyEFBToGL, 0, wxALL|wxEXPAND, 5);
|
||||
sRenderBoxRow1->Add(sSBox, 0, wxALL|wxEXPAND, 5);
|
||||
sbRendering->Add(sRenderBoxRow1);
|
||||
sAdvanced->Add(sbRendering, 0, wxEXPAND|wxALL, 5);
|
||||
|
||||
|
||||
sUtilities = new wxBoxSizer(wxHORIZONTAL);
|
||||
sUtilities->Add(m_DumpTextures, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sUtilities->Add(m_TexturePath, 1, wxALL|wxEXPAND, 5);
|
||||
sbUtilities->Add(sUtilities, 1, wxEXPAND);
|
||||
sAdvanced->Add(sbUtilities, 1, wxEXPAND|wxALL, 5);
|
||||
|
||||
sHacks = new wxGridBagSizer(0, 0);
|
||||
sHacks->Add(m_ProjectionHax1, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sHacks->Add(m_ProjectionHax2, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5);
|
||||
sHacks->Add(m_SafeTextureCache, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALL, 5);
|
||||
sbHacks->Add(sHacks);
|
||||
sAdvanced->Add(sbHacks, 0, wxEXPAND|wxALL, 5);
|
||||
// Sizers
|
||||
sAdvanced->Add(sbInfo, 0, wxEXPAND | wxALL, 5);
|
||||
sAdvanced->Add(sbRendering, 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
sAdvanced->Add(sbUtilities, 1, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
sAdvanced->Add(m_SizerHacksScreenSize, 0, wxEXPAND | (wxLEFT | wxDOWN | wxRIGHT), 5);
|
||||
|
||||
m_PageAdvanced->SetSizer(sAdvanced);
|
||||
sAdvanced->Layout();
|
||||
|
||||
Fit();
|
||||
Center();
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
void ConfigDialog::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
@ -405,6 +477,31 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
|
||||
g_Config.iMultisampleMode = atoi(m_AliasModeCB->GetValue().mb_str());
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
// Apparently we need a scroll event version of this for the sliders
|
||||
void ConfigDialog::AdvancedSettingsChanged(wxScrollEvent& event)
|
||||
{
|
||||
switch (event.GetId())
|
||||
{
|
||||
// Screen size
|
||||
case IDS_WIDTH:
|
||||
g_Config.iScreenWidth = m_SliderWidth->GetValue();
|
||||
break;
|
||||
case IDS_HEIGHT:
|
||||
g_Config.iScreenHeight = m_SliderHeight->GetValue();
|
||||
break;
|
||||
case IDS_LEFT:
|
||||
g_Config.iScreenLeft = m_SliderLeft->GetValue();
|
||||
break;
|
||||
case IDS_TOP:
|
||||
g_Config.iScreenTop = m_SliderTop->GetValue();
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
|
||||
@ -453,6 +550,7 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
|
||||
case ID_EFBCOPYDISABLEHOTKEY:
|
||||
g_Config.bEFBCopyDisableHotKey = m_EFBCopyDisableHotKey->IsChecked();
|
||||
break;
|
||||
// Hacks
|
||||
case ID_PROJECTIONHACK1:
|
||||
g_Config.bProjectionHax1 = m_ProjectionHax1->IsChecked();
|
||||
break;
|
||||
@ -462,6 +560,11 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
|
||||
case ID_SAFETEXTURECACHE:
|
||||
g_Config.bSafeTextureCache = m_SafeTextureCache->IsChecked();
|
||||
break;
|
||||
// Screen size
|
||||
case IDC_SCREEN_SIZE:
|
||||
g_Config.bScreenSize = m_ScreenSize->GetValue();
|
||||
break;
|
||||
// Extented frame buffer
|
||||
case ID_RADIO_COPYEFBTORAM:
|
||||
TextureMngr::ClearRenderTargets();
|
||||
g_Config.bCopyEFBToRAM = true;
|
||||
@ -479,6 +582,8 @@ void ConfigDialog::AdvancedSettingsChanged(wxCommandEvent& event)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
void ConfigDialog::TexturePathChange(wxFileDirPickerEvent& event)
|
||||
@ -487,3 +592,12 @@ void ConfigDialog::TexturePathChange(wxFileDirPickerEvent& event)
|
||||
// the combobox) this event wil not be fired.
|
||||
strcpy(g_Config.texDumpPath, event.GetPath().mb_str());
|
||||
}
|
||||
|
||||
void ConfigDialog::UpdateGUI()
|
||||
{
|
||||
// Update screen size labels
|
||||
m_TextScreenWidth->SetLabel(wxString::Format("Width: %i", g_Config.iScreenWidth));
|
||||
m_TextScreenHeight->SetLabel(wxString::Format("Height: %i", g_Config.iScreenHeight));
|
||||
m_TextScreenLeft->SetLabel(wxString::Format("Left: %i", g_Config.iScreenLeft));
|
||||
m_TextScreenTop->SetLabel(wxString::Format("Top: %i", g_Config.iScreenTop));
|
||||
}
|
@ -109,6 +109,10 @@ class ConfigDialog : public wxDialog
|
||||
wxCheckBox *m_ProjectionHax1;
|
||||
wxCheckBox *m_ProjectionHax2;
|
||||
wxCheckBox *m_SafeTextureCache;
|
||||
// Screen size
|
||||
wxStaticText *m_TextScreenWidth, *m_TextScreenHeight, *m_TextScreenLeft, *m_TextScreenTop;
|
||||
wxSlider *m_SliderWidth, *m_SliderHeight, *m_SliderLeft, *m_SliderTop;
|
||||
wxCheckBox *m_ScreenSize;
|
||||
|
||||
enum
|
||||
{
|
||||
@ -159,15 +163,21 @@ class ConfigDialog : public wxDialog
|
||||
ID_PROJECTIONHACK1,
|
||||
ID_PROJECTIONHACK2,
|
||||
ID_RADIO_COPYEFBTORAM,
|
||||
ID_RADIO_COPYEFBTOGL
|
||||
ID_RADIO_COPYEFBTOGL,
|
||||
|
||||
// Screen size
|
||||
IDS_WIDTH, IDS_LEFT,
|
||||
IDS_HEIGHT, IDS_TOP,
|
||||
IDC_SCREEN_SIZE
|
||||
};
|
||||
|
||||
void OnClose(wxCloseEvent& event);
|
||||
void CreateGUIControls();
|
||||
void UpdateGUI();
|
||||
|
||||
void AboutClick(wxCommandEvent& event);
|
||||
void GeneralSettingsChanged(wxCommandEvent& event);
|
||||
void AdvancedSettingsChanged(wxCommandEvent& event);
|
||||
void AdvancedSettingsChanged(wxCommandEvent& event); void AdvancedSettingsChanged(wxScrollEvent& event);
|
||||
void TexturePathChange(wxFileDirPickerEvent& event);
|
||||
};
|
||||
|
||||
|
@ -1153,7 +1153,9 @@ void UpdateViewport()
|
||||
2 * rawViewport[0], 2 * rawViewport[1],
|
||||
(rawViewport[5] - rawViewport[2]) / 16777215.0f, rawViewport[5] / 16777215.0f);*/
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Keep aspect ratio at 4:3
|
||||
// ------------------
|
||||
// rawViewport[0] = 320, rawViewport[1] = -240
|
||||
int scissorXOff = bpmem.scissorOffset.x * 2 - 342;
|
||||
int scissorYOff = bpmem.scissorOffset.y * 2 - 342;
|
||||
@ -1164,13 +1166,15 @@ void UpdateViewport()
|
||||
int xoffs = 0, yoffs = 0;
|
||||
int wid, hei, actualWid, actualHei;
|
||||
|
||||
// The rendering window width and height
|
||||
int winw = OpenGL_GetWidth();
|
||||
int winh = OpenGL_GetHeight();
|
||||
// The rendering window aspect ratio
|
||||
float ratio = (float)winw / (float)winh / fourThree;
|
||||
if (g_Config.bKeepAR)
|
||||
{
|
||||
// Check if height or width is the limiting factor
|
||||
if (ratio > 1) // then we are 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)
|
||||
{
|
||||
wAdj = ratio;
|
||||
hAdj = 1;
|
||||
@ -1183,7 +1187,8 @@ void UpdateViewport()
|
||||
overfl = (winw - actualWid) / actualRatiow;
|
||||
xoffs = overfl / 2;
|
||||
}
|
||||
else // the window is to high, we have to limit the height
|
||||
// The window is to high, we have to limit the height
|
||||
else
|
||||
{
|
||||
ratio = 1 / ratio;
|
||||
|
||||
@ -1204,24 +1209,62 @@ void UpdateViewport()
|
||||
wid = ceil(fabs(2 * xfregs.rawViewport[0]));
|
||||
hei = ceil(fabs(2 * xfregs.rawViewport[1]));
|
||||
}
|
||||
// -------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// GLViewPort variables
|
||||
// ------------------
|
||||
int GLWidth, GLHeight, GLx, GLy;
|
||||
// -------------------------------------
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Stretch picture while keeping the native resolution
|
||||
// ------------------
|
||||
if (g_Config.bStretchToFit)
|
||||
{
|
||||
glViewport(
|
||||
(int)(xfregs.rawViewport[3]-xfregs.rawViewport[0]-342-scissorXOff) + xoffs,
|
||||
Renderer::GetTargetHeight() - ((int)(xfregs.rawViewport[4]-xfregs.rawViewport[1]-342-scissorYOff)) + yoffs,
|
||||
wid, // width
|
||||
hei // height
|
||||
);
|
||||
GLx = (int)(xfregs.rawViewport[3]-xfregs.rawViewport[0]-342-scissorXOff) + xoffs;
|
||||
GLy = Renderer::GetTargetHeight() - ((int)(xfregs.rawViewport[4]-xfregs.rawViewport[1]-342-scissorYOff)) + yoffs;
|
||||
GLWidth = wid; // width
|
||||
GLHeight = hei; // height
|
||||
}
|
||||
else
|
||||
{
|
||||
float MValueX = OpenGL_GetXmax();
|
||||
float MValueY = OpenGL_GetYmax();
|
||||
glViewport((int)(xfregs.rawViewport[3]-xfregs.rawViewport[0]-342-scissorXOff) * MValueX,
|
||||
Renderer::GetTargetHeight()-((int)(xfregs.rawViewport[4]-xfregs.rawViewport[1]-342-scissorYOff)) * MValueY,
|
||||
abs((int)(2 * xfregs.rawViewport[0])) * MValueX, abs((int)(2 * xfregs.rawViewport[1])) * MValueY);
|
||||
|
||||
GLx = (int)(xfregs.rawViewport[3]-xfregs.rawViewport[0]-342-scissorXOff) * MValueX;
|
||||
GLy = Renderer::GetTargetHeight()-((int)(xfregs.rawViewport[4]-xfregs.rawViewport[1]-342-scissorYOff)) * MValueY;
|
||||
GLWidth = abs((int)(2 * xfregs.rawViewport[0])) * MValueX;
|
||||
GLHeight = abs((int)(2 * xfregs.rawViewport[1])) * MValueY;
|
||||
}
|
||||
// -------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// Adjust the screen size. If someone figures out how to correctly adjust the screen size as the GC or Wii does, this may not be needed.
|
||||
// ------------------
|
||||
if (g_Config.bScreenSize)
|
||||
{
|
||||
// Calculate width and height as a fraction of the current
|
||||
float Width = (float)GLWidth * ((float)g_Config.iScreenWidth / 100.0);
|
||||
float Height = (float)GLHeight * ((float)g_Config.iScreenHeight / 100.0);
|
||||
|
||||
// Adjust X and Y
|
||||
GLx = GLx + g_Config.iScreenLeft;
|
||||
GLy = GLy - g_Config.iScreenTop;
|
||||
|
||||
GLWidth = (int)Width;
|
||||
GLHeight = (int)Height;
|
||||
|
||||
//Console::Print("W:%i H:%i W:%f H:%f Wid:%i Hei:%i x:%i y:%i\n", g_Config.iScreenWidth, g_Config.iScreenHeight, Width, Height, GLWidth, GLHeight, GLx, GLy);
|
||||
}
|
||||
// -------------------------------------
|
||||
|
||||
glViewport(
|
||||
GLx, GLy,
|
||||
GLWidth, GLHeight
|
||||
);
|
||||
|
||||
glDepthRange((xfregs.rawViewport[5]- xfregs.rawViewport[2])/16777215.0f, xfregs.rawViewport[5]/16777215.0f);
|
||||
}
|
||||
|
Reference in New Issue
Block a user