diff --git a/Source/Core/VideoCommon/Src/BPFunctions.cpp b/Source/Core/VideoCommon/Src/BPFunctions.cpp index 9e2c99b6db..ca88cc5486 100644 --- a/Source/Core/VideoCommon/Src/BPFunctions.cpp +++ b/Source/Core/VideoCommon/Src/BPFunctions.cpp @@ -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 ©fmt, const int &scaleByHalf) { // 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); } diff --git a/Source/Core/VideoCommon/Src/RenderBase.cpp b/Source/Core/VideoCommon/Src/RenderBase.cpp index d4b90bc802..8aece882e4 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.cpp +++ b/Source/Core/VideoCommon/Src/RenderBase.cpp @@ -209,8 +209,8 @@ void Renderer::DrawDebugText() break; } - const char* const efbcopy_text = g_ActiveConfig.bEFBCopyDisable ? "Disabled" : - g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM"; + const char* const efbcopy_text = g_ActiveConfig.bEFBCopyEnable ? + (g_ActiveConfig.bCopyEFBToTexture ? "to Texture" : "to RAM") : "Disabled"; // The rows 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() { g_renderer->UpdateViewport(); diff --git a/Source/Core/VideoCommon/Src/RenderBase.h b/Source/Core/VideoCommon/Src/RenderBase.h index 15a4cb78b1..392a0252fc 100644 --- a/Source/Core/VideoCommon/Src/RenderBase.h +++ b/Source/Core/VideoCommon/Src/RenderBase.h @@ -113,6 +113,7 @@ protected: static std::string s_sScreenshotName; static bool CalculateTargetSize(float multiplier = 1); + static void CalculateXYScale(const TargetRectangle& dst_rect); static volatile bool s_bScreenshot; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index ec0df2e4d5..494b765f74 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -94,7 +94,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); 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", "EFBToTextureEnable", &bCopyEFBToTexture, false); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); @@ -123,7 +123,7 @@ void VideoConfig::GameIniLoad(const char *ini_file) if (iniFile.Exists("Video", "MaxAnisotropy")) iniFile.Get("Video", "MaxAnisotropy", &iMaxAnisotropy); // NOTE - this is x in (1 << x) if (iniFile.Exists("Video", "EFBCopyDisable")) - iniFile.Get("Video", "EFBCopyDisable", &bEFBCopyDisable); + iniFile.Get("Video", "EFBCopyEnable", &bEFBCopyEnable); if (iniFile.Exists("Video", "EFBCopyDisableHotKey")) iniFile.Get("Video", "EFBCopyDisableHotKey", &bOSDHotKey); if (iniFile.Exists("Video", "EFBToTextureEnable")) @@ -208,7 +208,7 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); iniFile.Set("Hacks", "DlistCachingEnable", bDlistCachingEnable); - iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); + iniFile.Set("Hacks", "EFBCopyEnable", bEFBCopyEnable); iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture); iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 5956771c82..0bfa4bf755 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -116,7 +116,7 @@ struct VideoConfig // Hacks bool bEFBAccessEnable; bool bDlistCachingEnable; - bool bEFBCopyDisable; // should reverse polarity of this one :) true=disabled can be confusing + bool bEFBCopyEnable; bool bOSDHotKey; bool bHack; bool bCopyEFBToTexture; diff --git a/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp b/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp index ee0a0276b5..a8f4aff139 100644 --- a/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp +++ b/Source/Core/VideoUICommon/Src/VideoConfigDiag.cpp @@ -182,7 +182,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, wxStaticBoxSizer* const group_efbcopy = new wxStaticBoxSizer(wxHORIZONTAL, page_general, wxT("Copy")); 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->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); diff --git a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp index 5db42fea95..8be2a4d5bc 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/Render.cpp @@ -327,8 +327,7 @@ Renderer::Renderer() TargetRectangle dst_rect; ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); - xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width; - yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height; + CalculateXYScale(dst_rect); s_LastEFBScale = g_ActiveConfig.iEFBScale; 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. 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); 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); - xScale = (float)(dst_rect.right - dst_rect.left) / (float)s_XFB_width; - yScale = (float)(dst_rect.bottom - dst_rect.top) / (float)s_XFB_height; + CalculateXYScale(dst_rect); s_LastEFBScale = g_ActiveConfig.iEFBScale; CalculateTargetSize(); @@ -985,7 +983,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons UpdateViewport(); VertexShaderManager::SetViewportChanged(); - g_VideoInitialize.pCopiedToXFB(XFBWrited || g_ActiveConfig.bUseRealXFB); + g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)); XFBWrited = false; } diff --git a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp index 739c1ca28e..6112daf069 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/main.cpp @@ -150,6 +150,8 @@ void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) void DllConfig(void *_hParent) { + g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx11.ini").c_str()); + std::vector adapters; IDXGIFactory* factory; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp index 44150410d6..c35c984758 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp @@ -163,9 +163,9 @@ void OSDMenu(WPARAM wParam) case '5': OSDChoice = 3; // 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; } else diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 1a113f3ddc..5cf0565e70 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -283,16 +283,7 @@ Renderer::Renderer() TargetRectangle dst_rect; ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); - if(g_ActiveConfig.bUseRealXFB) - { - 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; - } + CalculateXYScale(dst_rect); s_LastAA = g_ActiveConfig.iMultisampleMode; 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. 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); 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); - if(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; - } - } + CalculateXYScale(dst_rect); float SupersampleCoeficient = s_LastAA + 1; @@ -1208,7 +1181,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons // Renderer::SetZBufferRender(); // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, // GetTargetWidth(), GetTargetHeight()); - g_VideoInitialize.pCopiedToXFB(XFBWrited || g_ActiveConfig.bUseRealXFB); + g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)); XFBWrited = false; } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp index 9a81c72ddf..b7fb41ffac 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp @@ -161,7 +161,6 @@ void DllConfig(void *_hParent) if (!s_PluginInitialized) D3D::Init(); g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); - g_Config.GameIniLoad(globals->game_ini); UpdateActiveConfig(); #if defined(HAVE_WX) && HAVE_WX diff --git a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp index 1f67af795f..a4781c5d06 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/OS/Win32.cpp @@ -100,9 +100,9 @@ void OSDMenu(WPARAM wParam) case '5': OSDChoice = 3; // 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; } else diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 4a8c158d27..59e3b4b927 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -342,16 +342,7 @@ Renderer::Renderer() TargetRectangle dst_rect; ComputeDrawRectangle(s_backbuffer_width, s_backbuffer_height, false, &dst_rect); - if(g_ActiveConfig.bUseRealXFB) - { - 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; - } + CalculateXYScale(dst_rect); s_LastEFBScale = g_ActiveConfig.iEFBScale; CalculateTargetSize(); @@ -933,7 +924,7 @@ void Renderer::SetBlendMode(bool forceUpdate) // 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) { - 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); 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); - if(g_ActiveConfig.bUseRealXFB) - { - 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; - } + CalculateXYScale(dst_rect); if (CalculateTargetSize()) { @@ -1355,7 +1337,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons // Renderer::SetZBufferRender(); // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, // GetTargetWidth(), GetTargetHeight()); - g_VideoInitialize.pCopiedToXFB(XFBWrited || g_ActiveConfig.bUseRealXFB); + g_VideoInitialize.pCopiedToXFB(XFBWrited || (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)); XFBWrited = false; } diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp index 0c1c48204f..e72a11b2cb 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp @@ -166,7 +166,6 @@ void GetShaders(std::vector &shaders) void DllConfig(void *_hParent) { g_Config.Load((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_opengl.ini").c_str()); - g_Config.GameIniLoad(globals->game_ini); g_Config.UpdateProjectionHack(); UpdateActiveConfig(); #if defined(HAVE_WX) && HAVE_WX