Save frame skipping option, and allow loading it from game ini too.

This commit is contained in:
Rachel Bryk 2014-02-18 12:12:49 -05:00
parent a18e8249a4
commit b1f77d0191
4 changed files with 20 additions and 2 deletions

View File

@ -52,10 +52,10 @@ struct ConfigCache
int iCPUCore, Volume; int iCPUCore, Volume;
int iWiimoteSource[MAX_BBMOTES]; int iWiimoteSource[MAX_BBMOTES];
SIDevices Pads[MAX_SI_CHANNELS]; SIDevices Pads[MAX_SI_CHANNELS];
unsigned int framelimit; unsigned int framelimit, frameSkip;
TEXIDevices m_EXIDevice[MAX_EXI_CHANNELS]; TEXIDevices m_EXIDevice[MAX_EXI_CHANNELS];
std::string strBackend, sBackend; 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; static ConfigCache config_cache;
@ -114,6 +114,7 @@ bool BootCore(const std::string& _rFilename)
config_cache.Volume = SConfig::GetInstance().m_Volume; config_cache.Volume = SConfig::GetInstance().m_Volume;
config_cache.sBackend = SConfig::GetInstance().sBackend; config_cache.sBackend = SConfig::GetInstance().sBackend;
config_cache.framelimit = SConfig::GetInstance().m_Framelimit; config_cache.framelimit = SConfig::GetInstance().m_Framelimit;
config_cache.frameSkip = SConfig::GetInstance().m_FrameSkip;
for (unsigned int i = 0; i < MAX_BBMOTES; ++i) for (unsigned int i = 0; i < MAX_BBMOTES; ++i)
{ {
config_cache.iWiimoteSource[i] = g_wiimote_sources[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.bSetPads, (int)MAX_SI_CHANNELS, false);
std::fill_n(config_cache.bSetEXIDevice, (int)MAX_EXI_CHANNELS, false); std::fill_n(config_cache.bSetEXIDevice, (int)MAX_EXI_CHANNELS, false);
config_cache.bSetFramelimit = false; config_cache.bSetFramelimit = false;
config_cache.bSetFrameSkip = false;
// General settings // General settings
game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread); 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); 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)) if (game_ini.Get("Core", "FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit))
config_cache.bSetFramelimit = true; 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)) if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume))
config_cache.bSetVolume = true; config_cache.bSetVolume = true;
game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT); 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. // 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) if (config_cache.bSetFramelimit)
SConfig::GetInstance().m_Framelimit = config_cache.framelimit; 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) if (config_cache.bSetVolume)
SConfig::GetInstance().m_Volume = config_cache.Volume; SConfig::GetInstance().m_Volume = config_cache.Volume;

View File

@ -256,6 +256,7 @@ void SConfig::SaveSettings()
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Core", "FrameLimit", m_Framelimit); ini.Set("Core", "FrameLimit", m_Framelimit);
ini.Set("Core", "FrameSkip", m_FrameSkip);
// GFX Backend // GFX Backend
ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); 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", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false);
ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false); ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false);
ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
ini.Get("Core", "FrameSkip", &m_FrameSkip, 0);
// GFX Backend // GFX Backend
ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, ""); ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, "");

View File

@ -75,6 +75,7 @@ struct SConfig : NonCopyable
bool m_PauseMovie; bool m_PauseMovie;
bool m_ShowLag; bool m_ShowLag;
std::string m_strMovieAuthor; std::string m_strMovieAuthor;
unsigned int m_FrameSkip;
// DSP settings // DSP settings
bool m_EnableJIT; bool m_EnableJIT;

View File

@ -139,6 +139,8 @@ void CFrame::CreateMenu()
emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping")); emulationMenu->AppendSubMenu(skippingMenu, _("Frame S&kipping"));
for(int i = 0; i < 10; i++) for(int i = 0; i < 10; i++)
skippingMenu->Append(IDM_FRAMESKIP0 + i, wxString::Format(wxT("%i"), i), wxEmptyString, wxITEM_RADIO); 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->AppendSeparator();
emulationMenu->Append(IDM_SCREENSHOT, GetMenuLabel(HK_SCREENSHOT)); emulationMenu->Append(IDM_SCREENSHOT, GetMenuLabel(HK_SCREENSHOT));
@ -1547,6 +1549,7 @@ void CFrame::OnFrameSkip(wxCommandEvent& event)
int amount = event.GetId() - IDM_FRAMESKIP0; int amount = event.GetId() - IDM_FRAMESKIP0;
Movie::SetFrameSkipping((unsigned int)amount); Movie::SetFrameSkipping((unsigned int)amount);
SConfig::GetInstance().m_FrameSkip = amount;
} }