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