From b1f77d0191420311ab6a2bb936a088b85e6dcf5a Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Tue, 18 Feb 2014 12:12:49 -0500 Subject: [PATCH] Save frame skipping option, and allow loading it from game ini too. --- Source/Core/Core/BootManager.cpp | 16 ++++++++++++++-- Source/Core/Core/ConfigManager.cpp | 2 ++ Source/Core/Core/ConfigManager.h | 1 + Source/Core/DolphinWX/FrameTools.cpp | 3 +++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/BootManager.cpp b/Source/Core/Core/BootManager.cpp index f4f0cca870..651ff5e302 100644 --- a/Source/Core/Core/BootManager.cpp +++ b/Source/Core/Core/BootManager.cpp @@ -52,10 +52,10 @@ struct ConfigCache int iCPUCore, Volume; int iWiimoteSource[MAX_BBMOTES]; SIDevices Pads[MAX_SI_CHANNELS]; - unsigned int framelimit; + unsigned int framelimit, frameSkip; TEXIDevices m_EXIDevice[MAX_EXI_CHANNELS]; std::string strBackend, sBackend; - bool bSetFramelimit, bSetEXIDevice[MAX_EXI_CHANNELS], bSetVolume, bSetPads[MAX_SI_CHANNELS], bSetWiimoteSource[MAX_BBMOTES]; + bool bSetFramelimit, bSetEXIDevice[MAX_EXI_CHANNELS], bSetVolume, bSetPads[MAX_SI_CHANNELS], bSetWiimoteSource[MAX_BBMOTES], bSetFrameSkip; }; static ConfigCache config_cache; @@ -114,6 +114,7 @@ bool BootCore(const std::string& _rFilename) config_cache.Volume = SConfig::GetInstance().m_Volume; config_cache.sBackend = SConfig::GetInstance().sBackend; config_cache.framelimit = SConfig::GetInstance().m_Framelimit; + config_cache.frameSkip = SConfig::GetInstance().m_FrameSkip; for (unsigned int i = 0; i < MAX_BBMOTES; ++i) { config_cache.iWiimoteSource[i] = g_wiimote_sources[i]; @@ -130,6 +131,7 @@ bool BootCore(const std::string& _rFilename) std::fill_n(config_cache.bSetPads, (int)MAX_SI_CHANNELS, false); std::fill_n(config_cache.bSetEXIDevice, (int)MAX_EXI_CHANNELS, false); config_cache.bSetFramelimit = false; + config_cache.bSetFrameSkip = false; // General settings game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread); @@ -149,6 +151,11 @@ bool BootCore(const std::string& _rFilename) game_ini.Get("Core", "HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2); if (game_ini.Get("Core", "FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit)) config_cache.bSetFramelimit = true; + if (game_ini.Get("Core", "FrameSkip", &SConfig::GetInstance().m_FrameSkip)) + { + config_cache.bSetFrameSkip = true; + Movie::SetFrameSkipping(SConfig::GetInstance().m_FrameSkip); + } if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume)) config_cache.bSetVolume = true; game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT); @@ -266,6 +273,11 @@ void Stop() // Only change these back if they were actually set by game ini, since they can be changed while a game is running. if (config_cache.bSetFramelimit) SConfig::GetInstance().m_Framelimit = config_cache.framelimit; + if (config_cache.bSetFrameSkip) + { + SConfig::GetInstance().m_FrameSkip = config_cache.frameSkip; + Movie::SetFrameSkipping(config_cache.frameSkip); + } if (config_cache.bSetVolume) SConfig::GetInstance().m_Volume = config_cache.Volume; diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp index 2af8570ed1..0a831a83a9 100644 --- a/Source/Core/Core/ConfigManager.cpp +++ b/Source/Core/Core/ConfigManager.cpp @@ -256,6 +256,7 @@ void SConfig::SaveSettings() ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "FrameLimit", m_Framelimit); + ini.Set("Core", "FrameSkip", m_FrameSkip); // GFX Backend ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); @@ -417,6 +418,7 @@ void SConfig::LoadSettings() ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false); ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false); ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default + ini.Get("Core", "FrameSkip", &m_FrameSkip, 0); // GFX Backend ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, ""); diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h index d8763ef666..66b5e0eb1f 100644 --- a/Source/Core/Core/ConfigManager.h +++ b/Source/Core/Core/ConfigManager.h @@ -75,6 +75,7 @@ struct SConfig : NonCopyable bool m_PauseMovie; bool m_ShowLag; std::string m_strMovieAuthor; + unsigned int m_FrameSkip; // DSP settings bool m_EnableJIT; diff --git a/Source/Core/DolphinWX/FrameTools.cpp b/Source/Core/DolphinWX/FrameTools.cpp index b54524f2a6..87e51db736 100644 --- a/Source/Core/DolphinWX/FrameTools.cpp +++ b/Source/Core/DolphinWX/FrameTools.cpp @@ -139,6 +139,8 @@ void CFrame::CreateMenu() emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping")); for(int i = 0; i < 10; i++) skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(wxT("%i"), i), wxEmptyString, wxITEM_RADIO); + skippingMenu->Check(IDM_FRAMESKIP0 + SConfig::GetInstance().m_FrameSkip, true); + Movie::SetFrameSkipping(SConfig::GetInstance().m_FrameSkip); emulationMenu->AppendSeparator(); emulationMenu->Append(IDM_SCREENSHOT, GetMenuLabel(HK_SCREENSHOT)); @@ -1547,6 +1549,7 @@ void CFrame::OnFrameSkip(wxCommandEvent& event) int amount = event.GetId() - IDM_FRAMESKIP0; Movie::SetFrameSkipping((unsigned int)amount); + SConfig::GetInstance().m_FrameSkip = amount; }