Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #87 from RachelBryk/save-frame-skip
Save frame skipping option, and allow loading it from game ini too.
  • Loading branch information
Sonicadvance1 committed Feb 19, 2014
2 parents a18e824 + b1f77d0 commit afba0d7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Source/Core/Core/BootManager.cpp
Expand Up @@ -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;

Expand Down Expand Up @@ -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];
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions Source/Core/Core/ConfigManager.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -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, "");
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/ConfigManager.h
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions Source/Core/DolphinWX/FrameTools.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}


Expand Down

0 comments on commit afba0d7

Please sign in to comment.