Fixed RealXFB being enabled when XFB box is unchecked. Moved some shared code into VideoCommon. Renamed EFBCopyDisable setting to EFBCopy"Enable" in the code and inifile. Fix DX11 settings not loading. Fixed Issue 3378.(graphics settings dialog displaying gameini settings in game)

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6435 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak 2010-11-18 03:50:50 +00:00
parent bcad22f266
commit 0816fa2629
14 changed files with 50 additions and 73 deletions

View File

@ -80,7 +80,7 @@ void SetColorMask(const BPCmd &bp)
void CopyEFB(const BPCmd &bp, const EFBRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const int &scaleByHalf) void CopyEFB(const BPCmd &bp, const EFBRectangle &rc, const u32 &address, const bool &fromZBuffer, const bool &isIntensityFmt, const u32 &copyfmt, const int &scaleByHalf)
{ {
// bpmem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format) // bpmem.zcontrol.pixel_format to PIXELFMT_Z24 is when the game wants to copy from ZBuffer (Zbuffer uses 24-bit Format)
if (!g_ActiveConfig.bEFBCopyDisable) if (g_ActiveConfig.bEFBCopyEnable)
{ {
TextureCache::CopyRenderTargetToTexture(address, fromZBuffer, isIntensityFmt, copyfmt, !!scaleByHalf, rc); TextureCache::CopyRenderTargetToTexture(address, fromZBuffer, isIntensityFmt, copyfmt, !!scaleByHalf, rc);
} }

View File

@ -209,8 +209,8 @@ void Renderer::DrawDebugText()
break; break;
} }
const char* const efbcopy_text = g_ActiveConfig.bEFBCopyDisable ? "Disabled" : const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ?
g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM"; (g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled";
// The rows // The rows
const std::string lines[] = const std::string lines[] =
@ -258,6 +258,29 @@ void Renderer::DrawDebugText()
} }
} }
void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
{
if (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)
{
xScale = 1.0f;
yScale = 1.0f;
}
else
{
if (g_ActiveConfig.b3DVision)
{
// This works, yet the version in the else doesn't. No idea why.
xScale = (float)s_backbuffer_width / (float)s_XFB_width;
yScale = (float)s_backbuffer_height / (float)s_XFB_height;
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width;
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
}
}
void UpdateViewport() void UpdateViewport()
{ {
g_renderer->UpdateViewport(); g_renderer->UpdateViewport();

View File

@ -113,6 +113,7 @@ protected:
static std::string s_sScreenshotName; static std::string s_sScreenshotName;
static bool CalculateTargetSize(float multiplier = 1); static bool CalculateTargetSize(float multiplier = 1);
static void CalculateXYScale(const TargetRectangle& dst_rect);
static volatile bool s_bScreenshot; static volatile bool s_bScreenshot;

View File

@ -94,7 +94,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true);
iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false); iniFile.Get("Hacks", "DlistCachingEnable", &bDlistCachingEnable,false);
iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false); iniFile.Get("Hacks", "EFBCopyEnable", &bEFBCopyEnable, true);
iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0);
iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false);
iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true);
@ -123,7 +123,7 @@ void VideoConfig::GameIniLoad(const char *ini_file)
if (iniFile.Exists("Video", "MaxAnisotropy")) if (iniFile.Exists("Video", "MaxAnisotropy"))
iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x) iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x)
if (iniFile.Exists("Video", "EFBCopyDisable")) if (iniFile.Exists("Video", "EFBCopyDisable"))
iniFile.Get("Video", "EFBCopyDisable", &bEFBCopyDisable); iniFile.Get("Video", "EFBCopyEnable", &bEFBCopyEnable);
if (iniFile.Exists("Video", "EFBCopyDisableHotKey")) if (iniFile.Exists("Video", "EFBCopyDisableHotKey"))
iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey); iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey);
if (iniFile.Exists("Video", "EFBToTextureEnable")) if (iniFile.Exists("Video", "EFBToTextureEnable"))
@ -208,7 +208,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable);
iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable); iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable);
iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable);
iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey);
iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture);
iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled); iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled);

View File

@ -116,7 +116,7 @@ struct VideoConfig
// Hacks // Hacks
bool bEFBAccessEnable; bool bEFBAccessEnable;
bool bDlistCachingEnable; bool bDlistCachingEnable;
bool bEFBCopyDisable; // should reverse polarity of this one :) true=disabled can be confusing bool bEFBCopyEnable;
bool bOSDHotKey; bool bOSDHotKey;
bool bHack; bool bHack;
bool bCopyEFBToTexture; bool bCopyEFBToTexture;

View File

@ -182,7 +182,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title,
wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Copy")); wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Copy"));
group_efb->Add(group_efbcopy, 0, wxEXPAND | wxBOTTOM, 5); group_efb->Add(group_efbcopy, 0, wxEXPAND | wxBOTTOM, 5);
group_efbcopy->Add(new SettingCheckBox(page_general, wxT("Enable"), vconfig.bEFBCopyDisable, true), 0, wxLEFT | wxRIGHT | wxBOTTOM, 5); group_efbcopy->Add(new SettingCheckBox(page_general, wxT("Enable"), vconfig.bEFBCopyEnable), 0, wxLEFT | wxRIGHT | wxBOTTOM, 5);
group_efbcopy->AddStretchSpacer(1); group_efbcopy->AddStretchSpacer(1);
group_efbcopy->Add(new SettingRadioButton(page_general, wxT("Texture"), vconfig.bCopyEFBToTexture, false, wxRB_GROUP), 0, wxRIGHT, 5); group_efbcopy->Add(new SettingRadioButton(page_general, wxT("Texture"), vconfig.bCopyEFBToTexture, false, wxRB_GROUP), 0, wxRIGHT, 5);
group_efbcopy->Add(new SettingRadioButton(page_general, wxT("RAM"), vconfig.bCopyEFBToTexture, true), 0, wxRIGHT, 5); group_efbcopy->Add(new SettingRadioButton(page_general, wxT("RAM"), vconfig.bCopyEFBToTexture, true), 0, wxRIGHT, 5);

View File

@ -327,8 +327,7 @@ Renderer::Renderer()
TargetRectangle dst_rect; TargetRectangle dst_rect;
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width; CalculateXYScale(dst_rect);
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
s_LastEFBScale = g_ActiveConfig.iEFBScale; s_LastEFBScale = g_ActiveConfig.iEFBScale;
CalculateTargetSize(); CalculateTargetSize();
@ -780,7 +779,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
// This function has the final picture. We adjust the aspect ratio here. // This function has the final picture. We adjust the aspect ratio here.
void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc) void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc)
{ {
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.bUseRealXFB) || !fbWidth || !fbHeight) if (g_bSkipCurrentFrame || (!XFBWrited && (!g_ActiveConfig.bUseXFB || !g_ActiveConfig.bUseRealXFB)) || !fbWidth || !fbHeight)
{ {
g_VideoInitialize.pCopiedToXFB(false); g_VideoInitialize.pCopiedToXFB(false);
return; return;
@ -966,8 +965,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width; CalculateXYScale(dst_rect);
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
s_LastEFBScale = g_ActiveConfig.iEFBScale; s_LastEFBScale = g_ActiveConfig.iEFBScale;
CalculateTargetSize(); CalculateTargetSize();
@ -985,7 +983,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
UpdateViewport(); UpdateViewport();
VertexShaderManager::SetViewportChanged(); VertexShaderManager::SetViewportChanged();
g_VideoInitialize.pCopiedToXFB(XFBWrited || g_ActiveConfig.bUseRealXFB); g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
XFBWrited = false; XFBWrited = false;
} }

View File

@ -150,6 +150,8 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals)
void DllConfig(void *_hParent) void DllConfig(void *_hParent)
{ {
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx11.ini").c_str());
std::vector<std::string> adapters; std::vector<std::string> adapters;
IDXGIFactory* factory; IDXGIFactory* factory;

View File

@ -163,9 +163,9 @@ void OSDMenu(WPARAM wParam)
case '5': case '5':
OSDChoice = 3; OSDChoice = 3;
// Toggle EFB copy // Toggle EFB copy
if (g_Config.bEFBCopyDisable || g_Config.bCopyEFBToTexture) if (!g_Config.bEFBCopyEnable || g_Config.bCopyEFBToTexture)
{ {
g_Config.bEFBCopyDisable = !g_Config.bEFBCopyDisable; g_Config.bEFBCopyEnable ^= true;
g_Config.bCopyEFBToTexture = false; g_Config.bCopyEFBToTexture = false;
} }
else else

View File

@ -283,16 +283,7 @@ Renderer::Renderer()
TargetRectangle dst_rect; TargetRectangle dst_rect;
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
if(g_ActiveConfig.bUseRealXFB) CalculateXYScale(dst_rect);
{
xScale = 1.0f;
yScale = 1.0f;
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width;
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
s_LastAA = g_ActiveConfig.iMultisampleMode; s_LastAA = g_ActiveConfig.iMultisampleMode;
float SupersampleCoeficient = s_LastAA + 1; float SupersampleCoeficient = s_LastAA + 1;
@ -865,7 +856,7 @@ bool Renderer::SaveScreenshot(const std::string &filename, const TargetRectangle
// This function has the final picture. We adjust the aspect ratio here. // This function has the final picture. We adjust the aspect ratio here.
void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc) void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc)
{ {
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.bUseRealXFB) || !fbWidth || !fbHeight) if (g_bSkipCurrentFrame || (!XFBWrited && (!g_ActiveConfig.bUseXFB || !g_ActiveConfig.bUseRealXFB)) || !fbWidth || !fbHeight)
{ {
g_VideoInitialize.pCopiedToXFB(false); g_VideoInitialize.pCopiedToXFB(false);
return; return;
@ -1135,25 +1126,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
if(g_ActiveConfig.bUseRealXFB) CalculateXYScale(dst_rect);
{
xScale = 1.0f;
yScale = 1.0f;
}
else
{
if(g_ActiveConfig.b3DVision)
{
// This works, yet the version in the else doesn't. No idea why.
xScale = (float)s_backbuffer_width / (float)s_XFB_width;
yScale = (float)s_backbuffer_height / (float)s_XFB_height;
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width;
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
}
float SupersampleCoeficient = s_LastAA + 1; float SupersampleCoeficient = s_LastAA + 1;
@ -1208,7 +1181,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
// Renderer::SetZBufferRender(); // Renderer::SetZBufferRender();
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget,
// GetTargetWidth(), GetTargetHeight()); // GetTargetWidth(), GetTargetHeight());
g_VideoInitialize.pCopiedToXFB(XFBWrited || g_ActiveConfig.bUseRealXFB); g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
XFBWrited = false; XFBWrited = false;
} }

View File

@ -161,7 +161,6 @@ void DllConfig(void *_hParent)
if (!s_PluginInitialized) if (!s_PluginInitialized)
D3D::Init(); D3D::Init();
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str());
g_Config.GameIniLoad(globals->game_ini);
UpdateActiveConfig(); UpdateActiveConfig();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX

View File

@ -100,9 +100,9 @@ void OSDMenu(WPARAM wParam)
case '5': case '5':
OSDChoice = 3; OSDChoice = 3;
// Toggle EFB copy // Toggle EFB copy
if (g_Config.bEFBCopyDisable || g_Config.bCopyEFBToTexture) if (!g_Config.bEFBCopyEnable || g_Config.bCopyEFBToTexture)
{ {
g_Config.bEFBCopyDisable = !g_Config.bEFBCopyDisable; g_Config.bEFBCopyEnable ^= true;
g_Config.bCopyEFBToTexture = false; g_Config.bCopyEFBToTexture = false;
} }
else else

View File

@ -342,16 +342,7 @@ Renderer::Renderer()
TargetRectangle dst_rect; TargetRectangle dst_rect;
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
if(g_ActiveConfig.bUseRealXFB) CalculateXYScale(dst_rect);
{
xScale = 1.0f;
yScale = 1.0f;
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width;
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
s_LastEFBScale = g_ActiveConfig.iEFBScale; s_LastEFBScale = g_ActiveConfig.iEFBScale;
CalculateTargetSize(); CalculateTargetSize();
@ -933,7 +924,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
// This function has the final picture. We adjust the aspect ratio here. // This function has the final picture. We adjust the aspect ratio here.
void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc) void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,const EFBRectangle& rc)
{ {
if (g_bSkipCurrentFrame || (!XFBWrited && !g_ActiveConfig.bUseRealXFB) || !fbWidth || !fbHeight) if (g_bSkipCurrentFrame || (!XFBWrited && (!g_ActiveConfig.bUseXFB || !g_ActiveConfig.bUseRealXFB)) || !fbWidth || !fbHeight)
{ {
g_VideoInitialize.pCopiedToXFB(false); g_VideoInitialize.pCopiedToXFB(false);
return; return;
@ -1247,16 +1238,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
{ {
ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect);
if(g_ActiveConfig.bUseRealXFB) CalculateXYScale(dst_rect);
{
xScale = 1.0f;
yScale = 1.0f;
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width;
yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height;
}
if (CalculateTargetSize()) if (CalculateTargetSize())
{ {
@ -1355,7 +1337,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
// Renderer::SetZBufferRender(); // Renderer::SetZBufferRender();
// SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget,
// GetTargetWidth(), GetTargetHeight()); // GetTargetWidth(), GetTargetHeight());
g_VideoInitialize.pCopiedToXFB(XFBWrited || g_ActiveConfig.bUseRealXFB); g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB));
XFBWrited = false; XFBWrited = false;
} }

View File

@ -166,7 +166,6 @@ void GetShaders(std::vector<std::string> &shaders)
void DllConfig(void *_hParent) void DllConfig(void *_hParent)
{ {
g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str());
g_Config.GameIniLoad(globals->game_ini);
g_Config.UpdateProjectionHack(); g_Config.UpdateProjectionHack();
UpdateActiveConfig(); UpdateActiveConfig();
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX