1. Reorganized display settings
2. Let render to main window also have the internal resolution setting
3. Set render to main window as default setting, it's the most common and best option used by the best emulators
4. Changed screenshot to capture the internal picture, independent of whatever the window size may be

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3335 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson 2009-06-06 13:36:33 +00:00
parent 33a20fe564
commit a8dafb8dc5
6 changed files with 152 additions and 74 deletions

View File

@ -37,13 +37,12 @@ void Config::Load()
// get resolution // get resolution
iniFile.Get("Hardware", "WindowedRes", &temp, "640x480"); iniFile.Get("Hardware", "WindowedRes", &temp, "640x480");
strncpy(iWindowedRes, temp.c_str(), 16); strncpy(iWindowedRes, temp.c_str(), 16);
// apply this to the fullscreen resolution too
iniFile.Get("Hardware", "FullscreenRes", &temp, "640x480");
strncpy(iFSResolution, temp.c_str(), 16); strncpy(iFSResolution, temp.c_str(), 16);
iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware iniFile.Get("Hardware", "Fullscreen", &bFullscreen, 0); // Hardware
iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware
iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, false); iniFile.Get("Hardware", "RenderToMainframe", &renderToMainframe, true);
iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true); iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true);
iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false); iniFile.Get("Settings", "KeepAR_4_3", &bKeepAR43, false);
iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false); iniFile.Get("Settings", "KeepAR_16_9", &bKeepAR169, false);

View File

@ -160,19 +160,16 @@ void ConfigDialog::CreateGUIControls()
this->SetSizer(sMain); this->SetSizer(sMain);
this->Layout(); this->Layout();
// General // General Display Settings
sbBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Basic Settings")); sbBasic = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Basic Display Settings"));
m_Fullscreen = new wxCheckBox(m_PageGeneral, ID_FULLSCREEN, wxT("Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Fullscreen->SetValue(g_Config.bFullscreen);
m_VSync = new wxCheckBox(m_PageGeneral, ID_VSYNC, wxT("VSync (req. restart)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_VSync->SetValue(g_Config.bVSync);
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_NativeResolution = new wxCheckBox(m_PageGeneral, ID_NATIVERESOLUTION, wxT("Native resolution"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_NativeResolution = new wxCheckBox(m_PageGeneral, ID_NATIVERESOLUTION, wxT("native"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Aspect ratio / positioning controls // Aspect ratio / positioning controls
m_KeepAR43 = new wxCheckBox(m_PageGeneral, ID_KEEPAR_4_3, wxT("Keep 4:3 aspect ratio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); wxStaticText *KeepARText = new wxStaticText(m_PageGeneral, wxID_ANY, wxT("Keep aspect ratio:"), wxDefaultPosition, wxDefaultSize, 0);
m_KeepAR169 = new wxCheckBox(m_PageGeneral, ID_KEEPAR_16_9, wxT("Keep 16:9 aspect ratio"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_KeepAR43 = new wxCheckBox(m_PageGeneral, ID_KEEPAR_4_3, wxT("4:3"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_KeepAR169 = new wxCheckBox(m_PageGeneral, ID_KEEPAR_16_9, wxT("16:9"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Crop = new wxCheckBox(m_PageGeneral, ID_CROP, wxT("Crop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_Crop = new wxCheckBox(m_PageGeneral, ID_CROP, wxT("Crop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_UseXFB = new wxCheckBox(m_PageGeneral, ID_USEXFB, wxT("Use Real XFB"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); 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_AutoScale = new wxCheckBox(m_PageGeneral, ID_AUTOSCALE, wxT("Auto scale (try to remove borders)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
@ -189,14 +186,17 @@ void ConfigDialog::CreateGUIControls()
m_HideCursor->SetValue(g_Config.bHideCursor); m_HideCursor->SetValue(g_Config.bHideCursor);
#endif #endif
wxStaticText *FSText = new wxStaticText(m_PageGeneral, ID_FSTEXT, wxT("Fullscreen video mode:"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Internal resolution:"), wxDefaultPosition, wxDefaultSize, 0);
m_FullscreenCB = new wxComboBox(m_PageGeneral, ID_FULLSCREENCB, arrayStringFor_FullscreenCB[0], wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenCB, wxCB_READONLY, wxDefaultValidator);
m_FullscreenCB->SetValue(wxString::FromAscii(g_Config.iFSResolution));
wxStaticText *WMText = new wxStaticText(m_PageGeneral, ID_WMTEXT, wxT("Windowed resolution:"), wxDefaultPosition, wxDefaultSize, 0);
m_WindowResolutionCB = new wxComboBox(m_PageGeneral, ID_WINDOWRESOLUTIONCB, arrayStringFor_WindowResolutionCB[0], wxDefaultPosition, wxDefaultSize, arrayStringFor_WindowResolutionCB, wxCB_READONLY, wxDefaultValidator); 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.iWindowedRes)); m_WindowResolutionCB->SetValue(wxString::FromAscii(g_Config.iWindowedRes));
// Advanced Display Settings
sbBasicAdvanced = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Advanced Display Settings"));
m_Fullscreen = new wxCheckBox(m_PageGeneral, ID_FULLSCREEN, wxT("Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_Fullscreen->SetValue(g_Config.bFullscreen);
m_VSync = new wxCheckBox(m_PageGeneral, ID_VSYNC, wxT("VSync (req. restart)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_VSync->SetValue(g_Config.bVSync);
wxStaticText *MSAAText = new wxStaticText(m_PageGeneral, ID_MSAAMODETEXT, wxT("Antialias (MSAA):"), wxDefaultPosition, wxDefaultSize, 0); wxStaticText *MSAAText = new wxStaticText(m_PageGeneral, ID_MSAAMODETEXT, wxT("Antialias (MSAA):"), wxDefaultPosition, wxDefaultSize, 0);
m_MSAAModeCB = new wxChoice(m_PageGeneral, ID_MSAAMODECB, wxDefaultPosition, wxDefaultSize, arrayStringFor_MSAAModeCB, 0, wxDefaultValidator); m_MSAAModeCB = new wxChoice(m_PageGeneral, ID_MSAAMODECB, wxDefaultPosition, wxDefaultSize, arrayStringFor_MSAAModeCB, 0, wxDefaultValidator);
m_MSAAModeCB->Append(wxT("(off)")); m_MSAAModeCB->Append(wxT("(off)"));
@ -209,26 +209,26 @@ void ConfigDialog::CreateGUIControls()
m_MSAAModeCB->Append(wxT("16xQ CSAA")); m_MSAAModeCB->Append(wxT("16xQ CSAA"));
m_MSAAModeCB->SetSelection(g_Config.iMultisampleMode); m_MSAAModeCB->SetSelection(g_Config.iMultisampleMode);
// Tool tips // Tool tips
m_Fullscreen->SetToolTip(wxT( m_Fullscreen->SetToolTip(wxT(
"This will create a Fullscreen window using the chosen Fullscreen resolution." "This will create a Fullscreen window using the chosen Fullscreen resolution."
"\nPress Alt+Enter to switch between Fullscreen and Windowed mode." "\nPress Alt+Enter to switch between Fullscreen and Windowed mode."
)); "\n\nApplies instanty during gameplay: No"));
m_NativeResolution->SetToolTip(wxT( m_NativeResolution->SetToolTip(wxT(
"This will use the game's native resolution and stretch it to fill the" "This will use the game's native resolution and stretch it to fill the"
"\nwindow instead of changing the internal display resolution. It" "\nwindow instead of changing the internal display resolution. It"
"\nmay result in a slightly blurrier image, but it may also give a higher" "\nmay result in a blurrier image, but it may also give a higher"
"\nFPS if you have a slow graphics card.")); "\nFPS if you have a slow graphics card."
"\n\nApplies instanty during gameplay: Yes"));
m_Crop->SetToolTip(wxT( m_Crop->SetToolTip(wxT(
"Crop the picture instead of creating a letterbox. It will assume that your screen" "Crop the picture instead of creating a letterbox. It will assume that your screen"
"\nis of the 5:4 format if you have selected the 4:3 aspect ratio. It will assume" "\nis of the 5:4 format if you have selected the 4:3 aspect ratio. It will assume"
"\nthat your screen is of the 16:10 format if you have selected the 16:9 aspect ratio.")); "\nthat your screen is of the 16:10 format if you have selected the 16:9 aspect ratio."
m_FullscreenCB->SetToolTip(wxT( "\n\nApplies instanty during gameplay: Yes"));
"Select resolution for the (separate window) fullscreen mode."));
// This almost sounds like an unnecessary option
m_WindowResolutionCB->SetToolTip(wxT( m_WindowResolutionCB->SetToolTip(wxT(
"Select initial resolution for the separate rendering window.")); "Select internal resolution for the separate rendering window. This resolution also applies"
" to the fullscreen mode"
"\n\nApplies instanty during gameplay: No"));
// Enhancements // Enhancements
sbEnhancements = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Enhancements")); sbEnhancements = new wxStaticBoxSizer(wxVERTICAL, m_PageGeneral, wxT("Enhancements"));
@ -243,32 +243,37 @@ void ConfigDialog::CreateGUIControls()
m_ForceFiltering = new wxCheckBox(m_PageGeneral, ID_FORCEFILTERING, wxT("Force bi/trilinear filtering"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); m_ForceFiltering = new wxCheckBox(m_PageGeneral, ID_FORCEFILTERING, wxT("Force bi/trilinear filtering"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_ForceFiltering->SetValue(g_Config.bForceFiltering); m_ForceFiltering->SetValue(g_Config.bForceFiltering);
// Usage: The wxGBPosition() must have a column and row // How to use the wxGridBagSizer: The wxGBPosition() must have a column and row
sGeneral = new wxBoxSizer(wxVERTICAL); sGeneral = new wxBoxSizer(wxVERTICAL);
sBasic = new wxGridBagSizer(0, 0); sBasic = new wxGridBagSizer(0, 0);
sBasic->Add(m_Fullscreen, wxGBPosition(0, 0), wxGBSpan(1, 3), wxALL, 5);
sBasic->Add(m_VSync, wxGBPosition(1, 0), wxGBSpan(1, 3), wxALL, 5);
sBasic->Add(m_RenderToMainWindow, wxGBPosition(2, 0), wxGBSpan(1, 3), wxALL, 5);
sBasic->Add(m_AutoScale, wxGBPosition(3, 0), wxGBSpan(1, 3), wxALL, 5);
sBasic->Add(m_NativeResolution, wxGBPosition(4, 0), wxGBSpan(1, 3), wxALL, 5);
sBasic->Add(m_UseXFB, wxGBPosition(5, 0), wxGBSpan(1, 3), wxALL, 5);
sBasic->Add(m_KeepAR43, wxGBPosition(6, 0), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_KeepAR169, wxGBPosition(6, 1), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_Crop, wxGBPosition(6, 2), wxGBSpan(1, 1), wxALL, 5);
// Because of the ifdef here we need this variable for the row number sBasic->Add(WMText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
int Row = 7; sBasic->Add(m_NativeResolution, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxTOP, 0);
sBasic->Add(m_WindowResolutionCB, wxGBPosition(0, 2), wxGBSpan(1, 2), wxALL, 5);
sBasic->Add(KeepARText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_KeepAR43, wxGBPosition(1, 1), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_KeepAR169, wxGBPosition(1, 2), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(m_Crop, wxGBPosition(1, 3), wxGBSpan(1, 1), wxALL, 5);
// This option is configured from the main Dolphin.exe settings for _WIN32
#ifndef _WIN32 #ifndef _WIN32
sBasic->Add(m_HideCursor, wxGBPosition(Row++, 0), wxGBSpan(1, 3), wxALL, 5); sBasic->Add(m_HideCursor, wxGBPosition(5, 0), wxGBSpan(1, 3), wxALL, 5);
#endif #endif
sBasic->Add(FSText, wxGBPosition(Row, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_FullscreenCB, wxGBPosition(Row++, 1), wxGBSpan(1, 1), wxALL, 5);
sBasic->Add(WMText, wxGBPosition(Row, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL | wxALL, 5);
sBasic->Add(m_WindowResolutionCB, wxGBPosition(Row++, 1), wxGBSpan(1, 1), wxALL, 5);
sbBasic->Add(sBasic); sbBasic->Add(sBasic);
sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5); sGeneral->Add(sbBasic, 0, wxEXPAND|wxALL, 5);
sBasicAdvanced = new wxGridBagSizer(0, 0);
sBasicAdvanced->Add(m_Fullscreen, wxGBPosition(0, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_VSync, wxGBPosition(1, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_UseXFB, wxGBPosition(2, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_RenderToMainWindow, wxGBPosition(3, 0), wxGBSpan(1, 3), wxALL, 5);
sBasicAdvanced->Add(m_AutoScale, wxGBPosition(4, 0), wxGBSpan(1, 3), wxALL, 5);
sbBasicAdvanced->Add(sBasicAdvanced);
sGeneral->Add(sbBasicAdvanced, 0, wxEXPAND|wxALL, 5);
sEnhancements = new wxGridBagSizer(0, 0); sEnhancements = new wxGridBagSizer(0, 0);
sEnhancements->Add(AnisoText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); sEnhancements->Add(AnisoText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
sEnhancements->Add(m_MaxAnisotropyCB, wxGBPosition(0, 1), wxGBSpan(1, 2), wxALL, 5); sEnhancements->Add(m_MaxAnisotropyCB, wxGBPosition(0, 1), wxGBSpan(1, 2), wxALL, 5);
@ -502,11 +507,10 @@ void ConfigDialog::GeneralSettingsChanged(wxCommandEvent& event)
g_Config.bHideCursor = m_HideCursor->IsChecked(); g_Config.bHideCursor = m_HideCursor->IsChecked();
break; break;
#endif #endif
case ID_FULLSCREENCB:
strcpy(g_Config.iFSResolution, m_FullscreenCB->GetValue().mb_str() );
break;
case ID_WINDOWRESOLUTIONCB: case ID_WINDOWRESOLUTIONCB:
strcpy(g_Config.iWindowedRes, m_WindowResolutionCB->GetValue().mb_str() ); strcpy(g_Config.iWindowedRes, m_WindowResolutionCB->GetValue().mb_str() );
// Apply this resolution as fullscreen resolution too
strcpy(g_Config.iFSResolution, m_WindowResolutionCB->GetValue().mb_str() );
break; break;
case ID_MAXANISOTROPY: case ID_MAXANISOTROPY:
g_Config.iMaxAnisotropy = m_MaxAnisotropyCB->GetSelection() + 1; g_Config.iMaxAnisotropy = m_MaxAnisotropyCB->GetSelection() + 1;
@ -636,9 +640,12 @@ void ConfigDialog::UpdateGUI()
m_Fullscreen->Enable(!g_Config.renderToMainframe); m_Fullscreen->Enable(!g_Config.renderToMainframe);
if (g_Config.renderToMainframe) if (g_Config.renderToMainframe)
m_Fullscreen->SetValue(false); m_Fullscreen->SetValue(false);
m_FullscreenCB->Enable(!g_Config.renderToMainframe);
m_WindowResolutionCB->Enable(!g_Config.renderToMainframe); // Disable the internal resolution option if it's set to native
m_WindowResolutionCB->Enable(!g_Config.bNativeResolution);
} }
void Config::UpdateProjectionHack() void Config::UpdateProjectionHack()
{ {
switch(g_Config.iPhackvalue) switch(g_Config.iPhackvalue)

View File

@ -65,8 +65,8 @@ class ConfigDialog : public wxDialog
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
wxBoxSizer* sGeneral; wxBoxSizer* sGeneral;
wxStaticBoxSizer* sbBasic; wxStaticBoxSizer* sbBasic, *sbBasicAdvanced;
wxGridBagSizer* sBasic; wxGridBagSizer* sBasic, *sBasicAdvanced;
wxStaticBoxSizer* sbEnhancements; wxStaticBoxSizer* sbEnhancements;
wxGridBagSizer* sEnhancements; wxGridBagSizer* sEnhancements;
wxBoxSizer* sAdvanced; wxBoxSizer* sAdvanced;
@ -95,7 +95,6 @@ class ConfigDialog : public wxDialog
#ifndef _WIN32 #ifndef _WIN32
wxCheckBox *m_HideCursor; wxCheckBox *m_HideCursor;
#endif #endif
wxComboBox *m_FullscreenCB;
wxArrayString arrayStringFor_WindowResolutionCB; wxArrayString arrayStringFor_WindowResolutionCB;
wxComboBox *m_WindowResolutionCB; wxComboBox *m_WindowResolutionCB;
wxArrayString arrayStringFor_MaxAnisotropyCB; wxArrayString arrayStringFor_MaxAnisotropyCB;

View File

@ -50,6 +50,7 @@
#include "XFB.h" #include "XFB.h"
#include "OnScreenDisplay.h" #include "OnScreenDisplay.h"
#include "Timer.h" #include "Timer.h"
#include "StringUtil.h"
#include "main.h" // Local #include "main.h" // Local
#ifdef _WIN32 #ifdef _WIN32
@ -868,6 +869,32 @@ void Renderer::Swap(const TRectangle& rc)
v_max = (float)GetTargetHeight(); v_max = (float)GetTargetHeight();
} }
// ---------------------------------------------------------------------
// Save screenshot
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
if (s_bScreenshot)
{
s_criticalScreenshot.Enter();
/*
// Logging
char msg[255];
sprintf(msg, "Target: %i | %i %i %i %i\n",
(int)v_min,
//back_rc.top, back_rc.left, back_rc.right, back_rc.bottom);
rc.right, rc.bottom - (int)(v_min), rc.right, rc.bottom);
OSD::AddMessage(msg, 5000);
*/
// Save screenshot
SaveRenderTarget(s_sScreenshotName.c_str(), rc.right, rc.bottom, (int)(v_min));
// Reset settings
s_sScreenshotName = "";
s_bScreenshot = false;
s_criticalScreenshot.Leave();
}
// ---------------------------------------------------------------------
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1) if (/*s_bHaveFramebufferBlit*/ s_MSAASamples > 1)
@ -940,21 +967,6 @@ void Renderer::Swap(const TRectangle& rc)
if (g_Config.bWireFrame) if (g_Config.bWireFrame)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
// Take screenshot, if requested
if (s_bScreenshot) {
s_criticalScreenshot.Enter();
if (SaveRenderTarget(s_sScreenshotName.c_str(), OpenGL_GetBackbufferWidth(), OpenGL_GetBackbufferHeight())) {
char msg[255];
sprintf(msg, "Saved %s\n", s_sScreenshotName.c_str());
OSD::AddMessage(msg, 2000);
} else {
PanicAlert("Error capturing or saving screenshot.");
}
s_sScreenshotName = "";
s_bScreenshot = false;
s_criticalScreenshot.Leave();
}
// Frame dumps are handled a little differently in Windows // Frame dumps are handled a little differently in Windows
#ifdef _WIN32 #ifdef _WIN32
if (g_Config.bDumpFrames) { if (g_Config.bDumpFrames) {
@ -1262,18 +1274,60 @@ void Renderer::SetScreenshot(const char *filename)
s_criticalScreenshot.Leave(); s_criticalScreenshot.Leave();
} }
bool Renderer::SaveRenderTarget(const char *filename, int w, int h) bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
{ {
u8 *data = (u8 *)malloc(3 * w * h); // The height seemed to be one less than the setting sometimes (and sometimes not),
// perhaps a rounding error
if (H == 479) H = 480;
if (H == 599) H = 600;
if (H == 767) H = 768;
if (H == 1023) H = 1024;
u8 *data = (u8 *)malloc(3 * W * H);
glPixelStorei(GL_PACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, data); glReadPixels(0, YOffset, W, H, GL_RGB, GL_UNSIGNED_BYTE, data);
// Show failure messages
if (glGetError() != GL_NO_ERROR) if (glGetError() != GL_NO_ERROR)
return false; OSD::AddMessage("Error capturing or saving screenshot.", 2000);
FlipImageData(data, w, h); // Turn image upside down
FlipImageData(data, W, H);
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
wxImage a(w, h, data); // Create wxImage
wxImage a(W, H, data);
// ---------------------------------------------------------------------
// If it's not a 4:3 picture rescale it to 4:3. This only applied to native resolutions.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
// Todo: There is currently no adjustment for non-16:9 source pictures that are intended for a 16:9
// size because I think all Wii 16:9 source pictures are 16:9 to begin with. If not, add a 16:9 adjustment
// too.
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
/**/
float Ratio = (float)W / (float)(H);
// Don't bother with 1.25 resolutions either, for example 1280 x 1024
if (g_Config.bNativeResolution && Ratio != 4.0/3.0 && Ratio != 1.25 && Ratio != 16.0/9.0)
{
// Check if the height or width should be changed
if (Ratio < 4.0/3.0)
{
float fW = (float)W * 4.0/3.0;
W = (int)fW;
}
else
{
float fH = (float)W * 3.0/4.0;
H = (int)fH;
}
a.Rescale(W, H, wxIMAGE_QUALITY_HIGH);
}
// ---------------------------------------------------------------------
a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_BMP); a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_BMP);
bool result = true; bool result = true;
// Show success messages
OSD::AddMessage(StringFromFormat("Saved %i x %i %s\n", W, H, s_sScreenshotName.c_str()).c_str(), 2000);
#else #else
bool result = SaveTGA(filename, w, h, data); bool result = SaveTGA(filename, w, h, data);
free(data); free(data);

View File

@ -86,7 +86,7 @@ public:
static void DrawDebugText(); static void DrawDebugText();
static void SetScreenshot(const char *filename); static void SetScreenshot(const char *filename);
static void FlipImageData(u8 *data, int w, int h); static void FlipImageData(u8 *data, int w, int h);
static bool SaveRenderTarget(const char *filename, int w, int h); static bool SaveRenderTarget(const char *filename, int, int, int);
// Finish up the current frame, print some stats // Finish up the current frame, print some stats
static void Swap(const TRectangle& rc); static void Swap(const TRectangle& rc);

View File

@ -15,6 +15,25 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
//////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Plugin Documentation
/* ¯¯¯¯¯¯¯¯¯¯¯¯¯
1.1 Display settings
// ¯¯¯¯¯¯¯¯¯¯¯¯¯
Internal and fullscreen resolution: Since the only internal resolutions allowed are also
fullscreen resolution allowed by the system there is only need for one resolution setting
that applies to both the internal resolution and the fullscreen resolution.
Todo: Make the internal resolution option apply instantly, currently only the native or not option
applies instantly
////////////////////////////////////////////////////////////////////////////////////////*/
#include "Globals.h" #include "Globals.h"
#include <cstdarg> #include <cstdarg>