Change the screenshots rescale function to always work according to the A/R setting, and not just on native res: fixes 16/9 wii games.

remove IsATIDrawBuffer(), this might have been fixed in the drivers since some years already ?

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@3359 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
sl1nk3.s 2009-06-07 21:10:02 +00:00
parent c6abb79e6e
commit c9b5fbd9bd
5 changed files with 38 additions and 55 deletions

View File

@ -39,7 +39,7 @@ class IVolume
virtual bool Read(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual bool RAWRead(u64 _Offset, u64 _Length, u8* _pBuffer) const = 0;
virtual bool GetTitleID(u8* _pBuffer) const { return false; }
virtual bool GetTitleID(u8*) const { return false; }
virtual std::string GetUniqueID() const = 0;
virtual std::string GetMakerID() const = 0;
virtual std::string GetName() const = 0;

View File

@ -237,9 +237,9 @@ void CGameListCtrl::Update()
SetColumnWidth(COLUMN_BANNER, wxLIST_AUTOSIZE);
}
AutomaticColumnWidth();
Show();
AutomaticColumnWidth();
}
wxString NiceSizeFormat(s64 _size)

View File

@ -240,17 +240,6 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
plocal = strstr(plocal+13, "program.local");
}
if (Renderer::IsUsingATIDrawBuffers()) {
// Sometimes compilation can use ARB_draw_buffers, which would fail for ATI cards.
// Replace the three characters ARB with ATI. TODO - check whether this is fixed in modern ATI drivers.
char *poptions = strstr(pcompiledprog, "ARB_draw_buffers");
if (poptions != NULL) {
poptions[0] = 'A';
poptions[1] = 'T';
poptions[2] = 'I';
}
}
glGenProgramsARB(1, &ps.glprogid);
glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, ps.glprogid);
glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(pcompiledprog), pcompiledprog);

View File

@ -70,8 +70,6 @@
#include "Win32Window.h" // warning: crapcode
#else
#endif
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Declarations and definitions
@ -126,7 +124,6 @@ static GLuint s_DepthBuffer = 0;
static GLuint s_ResolvedRenderTarget = 0;
static GLuint s_ResolvedDepthTarget = 0;
static bool s_bATIDrawBuffers = false;
static bool s_bHaveStencilBuffer = false;
static bool s_bHaveFramebufferBlit = false;
static bool s_bHaveCoverageMSAA = false;
@ -238,10 +235,6 @@ bool Renderer::Init()
(const char*)glGetString(GL_RENDERER),
(const char*)glGetString(GL_VERSION)).c_str(), 5000);
// Checks if it ONLY has the ATI_draw_buffers extension, some have both
if (GLEW_ATI_draw_buffers && !GLEW_ARB_draw_buffers)
s_bATIDrawBuffers = true;
s_bFullscreen = g_Config.bFullscreen;
glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs);
@ -732,13 +725,6 @@ void Renderer::SetBlendMode(bool forceUpdate)
s_blendMode = newval;
}
bool Renderer::IsUsingATIDrawBuffers()
{
return s_bATIDrawBuffers;
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Function: This function handles the OpenGL glScissor() function
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
@ -793,8 +779,6 @@ bool Renderer::SetScissorRect()
return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////
// Aspect ratio functions
@ -1336,53 +1320,64 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset)
{
// 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 == 959) H = 960;
if (H == 1023) H = 1024;
if (H & 1)
H++;
u8 *data = (u8 *)malloc(3 * W * H);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, YOffset, W, H, GL_RGB, GL_UNSIGNED_BYTE, data);
// Show failure message
if (glGetError() != GL_NO_ERROR)
{
OSD::AddMessage("Error capturing or saving screenshot.", 2000);
return false;
}
// Turn image upside down
FlipImageData(data, W, H);
#if defined(HAVE_WX) && HAVE_WX
// Create wxImage
wxImage a(W, H, data);
// ---------------------------------------------------------------------
// If it's not a 4:3 picture rescale it to 4:3. For example in RE1 some native pictures
// have non-4:3 resolutions. This only applies 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);
if (g_Config.bNativeResolution && s_MSAASamples == 1 && !g_Config.bWireFrame
&& Ratio != 4.0/3.0 && Ratio != 16.0/9.0)
int nW, nH;
// Resize the output to correctly use the Aspect ratio setting
// This way, games are saved using the correct A/R scaling
if ((g_Config.bKeepAR169 || g_Config.bKeepAR43) && s_MSAASamples == 1 && !g_Config.bWireFrame)
{
float Ratio = (float)W / (float)H;
// Check if the height or width should be changed
if (Ratio < 4.0/3.0)
if (Ratio != 4.0f/3.0f && g_Config.bKeepAR43)
{
// Change the A/R to 4/3
float fW = (float)W * 4.0/3.0;
W = (int)fW;
nW = (int)floor(fW);
float fH = fW * 3.0/4.0;
nH = (int)floor(fH);
// Then rescale the width
W = nW * H / nH;
H = nH * H / nH;
}
else
if (Ratio != 16.0/9.0 && g_Config.bKeepAR169)
{
float fH = (float)W * 3.0/4.0;
H = (int)fH;
// Change the A/R to 16/9
float fW = (float)W * 16.0/9.0;
nW = (int)floor(fW);
float fH = fW * 9.0/16.0;
nH = (int)floor(fH);
// Then rescale the height
W = nW * W / nW;
H = nH * W / nW;
}
a.Rescale(W, H, wxIMAGE_QUALITY_HIGH);
}
// ---------------------------------------------------------------------
}
a.SaveFile(wxString::FromAscii(filename), wxBITMAP_TYPE_BMP);
bool result = true;
@ -1483,4 +1478,4 @@ void UpdateViewport()
DEBUG_LOG(CONSOLE, "----------------------------------------------------------------");
*/
}
//////////////////////////////////////////////////////////////////////////////////////////

View File

@ -54,7 +54,6 @@ public:
static void SwapBuffers();
static bool IsUsingATIDrawBuffers();
static bool IsBlack();
static void SetColorMask();
static void SetBlendMode(bool forceUpdate);