From 892678648eee7a1724b790fba0aa312e0fe8c728 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Sat, 5 Mar 2022 14:52:43 -0600 Subject: VideoCommon: trigger mod calls in TextureCacheBase (efb/xfb calls), VertexManagerBase (draw calls), and VertexShaderManager (projection calls) --- Source/Core/VideoCommon/RenderBase.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Source/Core/VideoCommon/RenderBase.cpp') diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index dbad9711f1..b13f74542c 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -67,6 +67,7 @@ #include "VideoCommon/FramebufferManager.h" #include "VideoCommon/FramebufferShaderGen.h" #include "VideoCommon/FreeLookCamera.h" +#include "VideoCommon/GraphicsModSystem/Config/GraphicsModGroup.h" #include "VideoCommon/NetPlayChatUI.h" #include "VideoCommon/NetPlayGolfUI.h" #include "VideoCommon/OnScreenDisplay.h" @@ -1309,6 +1310,11 @@ void Renderer::Swap(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height, u6 // behind the renderer. FlushFrameDump(); + if (g_ActiveConfig.bGraphicMods) + { + m_graphics_mod_manager.EndOfFrame(); + } + if (xfb_addr && fb_width && fb_stride && fb_height) { // Get the current XFB from texture cache @@ -1830,3 +1836,8 @@ std::unique_ptr Renderer::CreateAsyncShaderCom { return std::make_unique(); } + +const GraphicsModManager& Renderer::GetGraphicsModManager() const +{ + return m_graphics_mod_manager; +} -- cgit v1.2.3 From 69839df1eb2a594b81bceb8cfac58ccbba286628 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Tue, 15 Mar 2022 01:46:58 -0500 Subject: VideoCommon: support dynamically updating game mods at runtime --- Source/Core/VideoCommon/RenderBase.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'Source/Core/VideoCommon/RenderBase.cpp') diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index b13f74542c..412461d409 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -136,6 +136,22 @@ bool Renderer::Initialize() return false; } + if (g_ActiveConfig.bGraphicMods) + { + // If a config change occurred in a previous session, + // remember the old change count value. By setting + // our current change count to the old value, we + // avoid loading the stale data when we + // check for config changes. + const u32 old_game_mod_changes = g_ActiveConfig.graphics_mod_config ? + g_ActiveConfig.graphics_mod_config->GetChangeCount() : + 0; + g_ActiveConfig.graphics_mod_config = GraphicsModGroupConfig(SConfig::GetInstance().GetGameID()); + g_ActiveConfig.graphics_mod_config->Load(); + g_ActiveConfig.graphics_mod_config->SetChangeCount(old_game_mod_changes); + m_graphics_mod_manager.Load(*g_ActiveConfig.graphics_mod_config); + } + return true; } @@ -466,12 +482,27 @@ void Renderer::CheckForConfigChanges() const bool old_force_filtering = g_ActiveConfig.bForceFiltering; const bool old_vsync = g_ActiveConfig.bVSyncActive; const bool old_bbox = g_ActiveConfig.bBBoxEnable; + const u32 old_game_mod_changes = + g_ActiveConfig.graphics_mod_config ? g_ActiveConfig.graphics_mod_config->GetChangeCount() : 0; + const bool old_graphics_mods_enabled = g_ActiveConfig.bGraphicMods; UpdateActiveConfig(); FreeLook::UpdateActiveConfig(); g_freelook_camera.SetControlType(FreeLook::GetActiveConfig().camera_config.control_type); + if (g_ActiveConfig.bGraphicMods && !old_graphics_mods_enabled) + { + g_ActiveConfig.graphics_mod_config = GraphicsModGroupConfig(SConfig::GetInstance().GetGameID()); + g_ActiveConfig.graphics_mod_config->Load(); + } + + if (g_ActiveConfig.graphics_mod_config && + (old_game_mod_changes != g_ActiveConfig.graphics_mod_config->GetChangeCount())) + { + m_graphics_mod_manager.Load(*g_ActiveConfig.graphics_mod_config); + } + // Update texture cache settings with any changed options. g_texture_cache->OnConfigChanged(g_ActiveConfig); -- cgit v1.2.3