Qt GUI state recorder config window updates. Added estimated state save CPU time display. Pause on load time widgets in work.
This commit is contained in:
parent
3e9398f973
commit
86c6d3e56c
|
@ -28,6 +28,7 @@
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include "Qt/throttle.h"
|
||||||
#include "Qt/fceuWrapper.h"
|
#include "Qt/fceuWrapper.h"
|
||||||
#include "Qt/StateRecorderConf.h"
|
#include "Qt/StateRecorderConf.h"
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@
|
||||||
StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
QVBoxLayout *mainLayout;
|
QVBoxLayout *mainLayout, *vbox1;
|
||||||
QHBoxLayout *hbox, *hbox1;
|
QHBoxLayout *hbox, *hbox1;
|
||||||
QGroupBox *frame, *frame1;
|
QGroupBox *frame, *frame1;
|
||||||
QGridLayout *grid, *memStatsGrid;
|
QGridLayout *grid, *memStatsGrid;
|
||||||
|
@ -113,6 +114,8 @@ StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
||||||
g_config->getOption("SDL.StateRecorderCompressionLevel", &opt);
|
g_config->getOption("SDL.StateRecorderCompressionLevel", &opt);
|
||||||
cmprLvlCbox->setCurrentIndex(opt);
|
cmprLvlCbox->setCurrentIndex(opt);
|
||||||
|
|
||||||
|
connect( cmprLvlCbox, SIGNAL(currentIndexChanged(int)), this, SLOT(compressionLevelChanged(int)) );
|
||||||
|
|
||||||
hbox->addWidget(cmprLvlCbox);
|
hbox->addWidget(cmprLvlCbox);
|
||||||
|
|
||||||
frame->setLayout(hbox);
|
frame->setLayout(hbox);
|
||||||
|
@ -141,16 +144,45 @@ StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
||||||
|
|
||||||
frame->setLayout(hbox);
|
frame->setLayout(hbox);
|
||||||
|
|
||||||
|
frame1 = new QGroupBox(tr("Pause on Load:"));
|
||||||
|
vbox1 = new QVBoxLayout();
|
||||||
|
frame1->setLayout(vbox1);
|
||||||
|
|
||||||
|
pauseOnLoadCbox = new QComboBox();
|
||||||
|
pauseOnLoadCbox->addItem( tr("No"), 0 );
|
||||||
|
pauseOnLoadCbox->addItem( tr("Temporary"), 1 );
|
||||||
|
pauseOnLoadCbox->addItem( tr("Full"), 2 );
|
||||||
|
|
||||||
|
pauseDuration = new QSpinBox();
|
||||||
|
pauseDuration->setMinimum(0);
|
||||||
|
pauseDuration->setMaximum(60);
|
||||||
|
pauseDuration->setValue(3); // TODO
|
||||||
|
|
||||||
|
vbox1->addWidget(pauseOnLoadCbox);
|
||||||
|
|
||||||
|
frame = new QGroupBox( tr("Duration:") );
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
vbox1->addWidget(frame);
|
||||||
|
hbox->addWidget( pauseDuration);
|
||||||
|
hbox->addWidget( new QLabel( tr("Seconds") ) );
|
||||||
|
|
||||||
|
frame->setLayout(hbox);
|
||||||
|
|
||||||
|
grid->addWidget(frame1, 3, 0, 2, 1);
|
||||||
|
|
||||||
frame = new QGroupBox( tr("Memory Usage:") );
|
frame = new QGroupBox( tr("Memory Usage:") );
|
||||||
memStatsGrid = new QGridLayout();
|
memStatsGrid = new QGridLayout();
|
||||||
|
|
||||||
numSnapsLbl = new QLineEdit();
|
numSnapsLbl = new QLineEdit();
|
||||||
snapMemSizeLbl = new QLineEdit();
|
snapMemSizeLbl = new QLineEdit();
|
||||||
totalMemUsageLbl = new QLineEdit();
|
totalMemUsageLbl = new QLineEdit();
|
||||||
|
saveTimeLbl = new QLineEdit();
|
||||||
|
|
||||||
numSnapsLbl->setReadOnly(true);
|
numSnapsLbl->setReadOnly(true);
|
||||||
snapMemSizeLbl->setReadOnly(true);
|
snapMemSizeLbl->setReadOnly(true);
|
||||||
totalMemUsageLbl->setReadOnly(true);
|
totalMemUsageLbl->setReadOnly(true);
|
||||||
|
saveTimeLbl->setReadOnly(true);
|
||||||
|
|
||||||
grid->addWidget(frame, 1, 3, 2, 2);
|
grid->addWidget(frame, 1, 3, 2, 2);
|
||||||
frame->setLayout(memStatsGrid);
|
frame->setLayout(memStatsGrid);
|
||||||
|
@ -163,6 +195,15 @@ StateRecorderDialog_t::StateRecorderDialog_t(QWidget *parent)
|
||||||
memStatsGrid->addWidget( new QLabel( tr("Total Size:") ), 2, 0 );
|
memStatsGrid->addWidget( new QLabel( tr("Total Size:") ), 2, 0 );
|
||||||
memStatsGrid->addWidget( totalMemUsageLbl, 2, 1 );
|
memStatsGrid->addWidget( totalMemUsageLbl, 2, 1 );
|
||||||
|
|
||||||
|
frame = new QGroupBox( tr("CPU Usage:") );
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
frame->setLayout(hbox);
|
||||||
|
|
||||||
|
hbox->addWidget(new QLabel(tr("Save Time:")));
|
||||||
|
hbox->addWidget(saveTimeLbl);
|
||||||
|
|
||||||
|
grid->addWidget(frame, 3, 3, 1, 1);
|
||||||
|
|
||||||
mainLayout->addLayout(grid);
|
mainLayout->addLayout(grid);
|
||||||
|
|
||||||
hbox = new QHBoxLayout();
|
hbox = new QHBoxLayout();
|
||||||
|
@ -218,6 +259,7 @@ void StateRecorderDialog_t::applyChanges(void)
|
||||||
config.timeBetweenSnapsMinutes = static_cast<float>( snapMinutes->value() ) +
|
config.timeBetweenSnapsMinutes = static_cast<float>( snapMinutes->value() ) +
|
||||||
( 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();
|
||||||
|
|
||||||
FCEU_WRAPPER_LOCK();
|
FCEU_WRAPPER_LOCK();
|
||||||
FCEU_StateRecorderSetEnabled( recorderEnable->isChecked() );
|
FCEU_StateRecorderSetEnabled( recorderEnable->isChecked() );
|
||||||
|
@ -231,6 +273,7 @@ void StateRecorderDialog_t::applyChanges(void)
|
||||||
g_config->setOption("SDL.StateRecorderHistoryDurationMin", historyDuration->value() );
|
g_config->setOption("SDL.StateRecorderHistoryDurationMin", historyDuration->value() );
|
||||||
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.StateRecorderEnable", recorderEnable->isChecked() );
|
g_config->setOption("SDL.StateRecorderEnable", recorderEnable->isChecked() );
|
||||||
g_config->save();
|
g_config->save();
|
||||||
}
|
}
|
||||||
|
@ -252,6 +295,11 @@ void StateRecorderDialog_t::spinBoxValueChanged(int newValue)
|
||||||
recalcMemoryUsage();
|
recalcMemoryUsage();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void StateRecorderDialog_t::compressionLevelChanged(int newValue)
|
||||||
|
{
|
||||||
|
recalcMemoryUsage();
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void StateRecorderDialog_t::recalcMemoryUsage(void)
|
void StateRecorderDialog_t::recalcMemoryUsage(void)
|
||||||
{
|
{
|
||||||
char stmp[64];
|
char stmp[64];
|
||||||
|
@ -272,16 +320,32 @@ void StateRecorderDialog_t::recalcMemoryUsage(void)
|
||||||
|
|
||||||
numSnapsLbl->setText( tr(stmp) );
|
numSnapsLbl->setText( tr(stmp) );
|
||||||
|
|
||||||
|
saveTimeMs = 0.0;
|
||||||
|
|
||||||
if (GameInfo)
|
if (GameInfo)
|
||||||
{
|
{
|
||||||
|
constexpr int numIterations = 10;
|
||||||
|
double ts_start, ts_end;
|
||||||
|
|
||||||
FCEU_WRAPPER_LOCK();
|
FCEU_WRAPPER_LOCK();
|
||||||
|
|
||||||
EMUFILE_MEMORY em;
|
EMUFILE_MEMORY em;
|
||||||
int compressionLevel = 0;
|
int compressionLevel = cmprLvlCbox->currentData().toInt();
|
||||||
|
|
||||||
|
ts_start = getHighPrecTimeStamp();
|
||||||
|
|
||||||
|
// Perform State Save multiple times to get a good average
|
||||||
|
// on what the compression delays will be.
|
||||||
|
for (int i=0; i<numIterations; i++)
|
||||||
|
{
|
||||||
|
em.set_len(0);
|
||||||
FCEUSS_SaveMS( &em, compressionLevel );
|
FCEUSS_SaveMS( &em, compressionLevel );
|
||||||
|
}
|
||||||
|
ts_end = getHighPrecTimeStamp();
|
||||||
|
|
||||||
fsnapSize = static_cast<float>( em.size() ) / 1024.0f;
|
saveTimeMs = (ts_end - ts_start) * 1000.0 / static_cast<double>(numIterations);
|
||||||
|
|
||||||
|
fsnapSize = static_cast<float>( em.size() );
|
||||||
|
|
||||||
FCEU_WRAPPER_UNLOCK();
|
FCEU_WRAPPER_UNLOCK();
|
||||||
}
|
}
|
||||||
|
@ -313,5 +377,8 @@ void StateRecorderDialog_t::recalcMemoryUsage(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
totalMemUsageLbl->setText( tr(stmp) );
|
totalMemUsageLbl->setText( tr(stmp) );
|
||||||
|
|
||||||
|
sprintf( stmp, "%.02f ms", saveTimeMs);
|
||||||
|
saveTimeLbl->setText( tr(stmp) );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
|
@ -31,13 +31,18 @@ protected:
|
||||||
QSpinBox *snapMinutes;
|
QSpinBox *snapMinutes;
|
||||||
QSpinBox *snapSeconds;
|
QSpinBox *snapSeconds;
|
||||||
QSpinBox *historyDuration;
|
QSpinBox *historyDuration;
|
||||||
|
QSpinBox *pauseDuration;
|
||||||
QCheckBox *recorderEnable;
|
QCheckBox *recorderEnable;
|
||||||
QLineEdit *numSnapsLbl;
|
QLineEdit *numSnapsLbl;
|
||||||
QLineEdit *snapMemSizeLbl;
|
QLineEdit *snapMemSizeLbl;
|
||||||
QLineEdit *totalMemUsageLbl;
|
QLineEdit *totalMemUsageLbl;
|
||||||
|
QLineEdit *saveTimeLbl;
|
||||||
QPushButton *applyButton;
|
QPushButton *applyButton;
|
||||||
QPushButton *closeButton;
|
QPushButton *closeButton;
|
||||||
QComboBox *cmprLvlCbox;
|
QComboBox *cmprLvlCbox;
|
||||||
|
QComboBox *pauseOnLoadCbox;
|
||||||
|
|
||||||
|
double saveTimeMs;
|
||||||
|
|
||||||
void recalcMemoryUsage(void);
|
void recalcMemoryUsage(void);
|
||||||
|
|
||||||
|
@ -47,4 +52,5 @@ private slots:
|
||||||
void applyChanges(void);
|
void applyChanges(void);
|
||||||
void spinBoxValueChanged(int newValue);
|
void spinBoxValueChanged(int newValue);
|
||||||
void enableChanged(int);
|
void enableChanged(int);
|
||||||
|
void compressionLevelChanged(int newValue);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue