For Qt GUI, hooked up state recorder pause on load options.
This commit is contained in:
parent
86c6d3e56c
commit
e95c0fe86b
|
@ -144,19 +144,27 @@ StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
|||
|
||||
frame->setLayout(hbox);
|
||||
|
||||
frame1 = new QGroupBox(tr("Pause on Load:"));
|
||||
frame1 = new QGroupBox(tr("Pause on State Load:"));
|
||||
vbox1 = new QVBoxLayout();
|
||||
frame1->setLayout(vbox1);
|
||||
|
||||
g_config->getOption("SDL.StateRecorderPauseOnLoad", &opt);
|
||||
|
||||
pauseOnLoadCbox = new QComboBox();
|
||||
pauseOnLoadCbox->addItem( tr("No"), 0 );
|
||||
pauseOnLoadCbox->addItem( tr("Temporary"), 1 );
|
||||
pauseOnLoadCbox->addItem( tr("Full"), 2 );
|
||||
pauseOnLoadCbox->addItem( tr("No"), StateRecorderConfigData::NO_PAUSE );
|
||||
pauseOnLoadCbox->addItem( tr("Temporary"), StateRecorderConfigData::TEMPORARY_PAUSE );
|
||||
pauseOnLoadCbox->addItem( tr("Full"), StateRecorderConfigData::FULL_PAUSE );
|
||||
|
||||
pauseOnLoadCbox->setCurrentIndex( opt );
|
||||
|
||||
connect( pauseOnLoadCbox, SIGNAL(currentIndexChanged(int)), this, SLOT(pauseOnLoadChanged(int)) );
|
||||
|
||||
g_config->getOption("SDL.StateRecorderPauseDuration", &opt);
|
||||
|
||||
pauseDuration = new QSpinBox();
|
||||
pauseDuration->setMinimum(0);
|
||||
pauseDuration->setMaximum(60);
|
||||
pauseDuration->setValue(3); // TODO
|
||||
pauseDuration->setValue(opt);
|
||||
|
||||
vbox1->addWidget(pauseOnLoadCbox);
|
||||
|
||||
|
@ -227,6 +235,7 @@ StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
|||
restoreGeometry(settings.value("stateRecorderWindow/geometry").toByteArray());
|
||||
|
||||
recalcMemoryUsage();
|
||||
pauseOnLoadChanged( pauseOnLoadCbox->currentIndex() );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
StateRecorderDialog_t::~StateRecorderDialog_t(void)
|
||||
|
@ -260,6 +269,7 @@ void StateRecorderDialog_t::applyChanges(void)
|
|||
( static_cast<float>( snapSeconds->value() ) / 60.0f );
|
||||
config.compressionLevel = cmprLvlCbox->currentData().toInt();
|
||||
config.loadPauseTimeSeconds = pauseDuration->value();
|
||||
config.pauseOnLoad = static_cast<StateRecorderConfigData::PauseType>( pauseOnLoadCbox->currentData().toInt() );
|
||||
|
||||
FCEU_WRAPPER_LOCK();
|
||||
FCEU_StateRecorderSetEnabled( recorderEnable->isChecked() );
|
||||
|
@ -274,6 +284,8 @@ void StateRecorderDialog_t::applyChanges(void)
|
|||
g_config->setOption("SDL.StateRecorderTimeBetweenSnapsMin", snapMinutes->value() );
|
||||
g_config->setOption("SDL.StateRecorderTimeBetweenSnapsSec", snapSeconds->value() );
|
||||
g_config->setOption("SDL.StateRecorderCompressionLevel", config.compressionLevel);
|
||||
g_config->setOption("SDL.StateRecorderPauseOnLoad", config.pauseOnLoad);
|
||||
g_config->setOption("SDL.StateRecorderPauseDuration", config.loadPauseTimeSeconds);
|
||||
g_config->setOption("SDL.StateRecorderEnable", recorderEnable->isChecked() );
|
||||
g_config->save();
|
||||
}
|
||||
|
@ -300,6 +312,15 @@ void StateRecorderDialog_t::compressionLevelChanged(int newValue)
|
|||
recalcMemoryUsage();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void StateRecorderDialog_t::pauseOnLoadChanged(int index)
|
||||
{
|
||||
StateRecorderConfigData::PauseType pauseOnLoad;
|
||||
|
||||
pauseOnLoad = static_cast<StateRecorderConfigData::PauseType>( pauseOnLoadCbox->currentData().toInt() );
|
||||
|
||||
pauseDuration->setEnabled( pauseOnLoad == StateRecorderConfigData::TEMPORARY_PAUSE );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void StateRecorderDialog_t::recalcMemoryUsage(void)
|
||||
{
|
||||
char stmp[64];
|
||||
|
|
|
@ -53,4 +53,5 @@ private slots:
|
|||
void spinBoxValueChanged(int newValue);
|
||||
void enableChanged(int);
|
||||
void compressionLevelChanged(int newValue);
|
||||
void pauseOnLoadChanged(int index);
|
||||
};
|
||||
|
|
|
@ -759,6 +759,8 @@ InitConfig()
|
|||
config->addOption("SDL.StateRecorderTimeBetweenSnapsMin", 0);
|
||||
config->addOption("SDL.StateRecorderTimeBetweenSnapsSec", 3);
|
||||
config->addOption("SDL.StateRecorderCompressionLevel", 0);
|
||||
config->addOption("SDL.StateRecorderPauseOnLoad", 1);
|
||||
config->addOption("SDL.StateRecorderPauseDuration", 3);
|
||||
|
||||
//TODO implement this
|
||||
config->addOption("periodicsaves", "SDL.PeriodicSaves", 0);
|
||||
|
|
|
@ -980,11 +980,16 @@ int fceuWrapperInit( int argc, char *argv[] )
|
|||
int srTimeBtwSnapsMin = 0;
|
||||
int srTimeBtwSnapsSec = 3;
|
||||
int srCompressionLevel = 0;
|
||||
int pauseOnLoadTime = 3;
|
||||
int pauseOnLoad = StateRecorderConfigData::TEMPORARY_PAUSE;
|
||||
|
||||
g_config->getOption("SDL.StateRecorderEnable", &srEnable);
|
||||
g_config->getOption("SDL.StateRecorderHistoryDurationMin", &srHistDurMin);
|
||||
g_config->getOption("SDL.StateRecorderTimeBetweenSnapsMin", &srTimeBtwSnapsMin);
|
||||
g_config->getOption("SDL.StateRecorderTimeBetweenSnapsSec", &srTimeBtwSnapsSec);
|
||||
g_config->getOption("SDL.StateRecorderCompressionLevel", &srCompressionLevel);
|
||||
g_config->getOption("SDL.StateRecorderPauseOnLoad", &pauseOnLoad);
|
||||
g_config->getOption("SDL.StateRecorderPauseDuration", &pauseOnLoadTime);
|
||||
|
||||
StateRecorderConfigData srConfig;
|
||||
|
||||
|
@ -992,6 +997,8 @@ int fceuWrapperInit( int argc, char *argv[] )
|
|||
srConfig.timeBetweenSnapsMinutes = static_cast<float>( srTimeBtwSnapsMin ) +
|
||||
( static_cast<float>( srTimeBtwSnapsSec ) / 60.0f );
|
||||
srConfig.compressionLevel = srCompressionLevel;
|
||||
srConfig.loadPauseTimeSeconds = pauseOnLoadTime;
|
||||
srConfig.pauseOnLoad = static_cast<StateRecorderConfigData::PauseType>(pauseOnLoad);
|
||||
|
||||
FCEU_StateRecorderSetEnabled( srEnable );
|
||||
FCEU_StateRecorderSetConfigData( srConfig );
|
||||
|
|
|
@ -1206,6 +1206,7 @@ class StateRecorder
|
|||
loadIndexReset = false;
|
||||
lastLoadFrame = 0;
|
||||
loadPauseTime = 3;
|
||||
pauseOnLoad = StateRecorderConfigData::TEMPORARY_PAUSE;
|
||||
}
|
||||
|
||||
~StateRecorder(void)
|
||||
|
@ -1245,6 +1246,7 @@ class StateRecorder
|
|||
|
||||
compressionLevel = stateRecorderConfig.compressionLevel;
|
||||
loadPauseTime = stateRecorderConfig.loadPauseTimeSeconds;
|
||||
pauseOnLoad = stateRecorderConfig.pauseOnLoad;
|
||||
}
|
||||
|
||||
void update(void)
|
||||
|
@ -1320,11 +1322,17 @@ class StateRecorder
|
|||
lastState = snapIdx;
|
||||
loadIndexReset = true;
|
||||
|
||||
if (loadPauseTime > 0)
|
||||
{ // Temporary pause after loading new state for user to have time to process
|
||||
FCEUI_PauseForDuration(loadPauseTime);
|
||||
if (pauseOnLoad == StateRecorderConfigData::TEMPORARY_PAUSE)
|
||||
{
|
||||
if (loadPauseTime > 0)
|
||||
{ // Temporary pause after loading new state for user to have time to process
|
||||
FCEUI_PauseForDuration(loadPauseTime);
|
||||
}
|
||||
}
|
||||
else if (pauseOnLoad == StateRecorderConfigData::FULL_PAUSE)
|
||||
{
|
||||
FCEUI_SetEmulationPaused( EMULATIONPAUSED_PAUSED );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1370,6 +1378,7 @@ class StateRecorder
|
|||
int ringBufSize;
|
||||
int compressionLevel;
|
||||
int loadPauseTime;
|
||||
StateRecorderConfigData::PauseType pauseOnLoad;
|
||||
unsigned int frameCounter;
|
||||
unsigned int framesPerSnap;
|
||||
unsigned int lastLoadFrame;
|
||||
|
@ -1444,5 +1453,10 @@ const StateRecorderConfigData& FCEU_StateRecorderGetConfigData(void)
|
|||
int FCEU_StateRecorderSetConfigData(const StateRecorderConfigData &newConfig)
|
||||
{
|
||||
stateRecorderConfig = newConfig;
|
||||
|
||||
if (stateRecorder != nullptr)
|
||||
{
|
||||
stateRecorder->loadConfig( stateRecorderConfig );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -86,12 +86,20 @@ struct StateRecorderConfigData
|
|||
int compressionLevel;
|
||||
int loadPauseTimeSeconds;
|
||||
|
||||
enum PauseType
|
||||
{
|
||||
NO_PAUSE = 0,
|
||||
TEMPORARY_PAUSE,
|
||||
FULL_PAUSE,
|
||||
} pauseOnLoad;
|
||||
|
||||
StateRecorderConfigData(void)
|
||||
{
|
||||
historyDurationMinutes = 15.0f;
|
||||
timeBetweenSnapsMinutes = 3.0f / 60.0f;
|
||||
compressionLevel = 0;
|
||||
loadPauseTimeSeconds = 3;
|
||||
pauseOnLoad = TEMPORARY_PAUSE;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue