mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
VideoCommon: support dynamically updating game mods at runtime
This commit is contained in:
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user