Added timing options selection combo box to timing window on Qt GUI.
This commit is contained in:
parent
f198996cd4
commit
4812c804fd
|
@ -19,6 +19,7 @@
|
|||
#include "Qt/input.h"
|
||||
#include "Qt/config.h"
|
||||
#include "Qt/keyscan.h"
|
||||
#include "Qt/throttle.h"
|
||||
#include "Qt/fceuWrapper.h"
|
||||
#include "Qt/ConsoleWindow.h"
|
||||
#include "Qt/TimingConf.h"
|
||||
|
@ -61,7 +62,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
{
|
||||
int opt;
|
||||
QVBoxLayout *mainLayout;
|
||||
//QHBoxLayout *hbox;
|
||||
QHBoxLayout *hbox;
|
||||
QGridLayout *grid;
|
||||
QGroupBox *emuPrioBox, *guiPrioBox;
|
||||
|
||||
|
@ -118,6 +119,17 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
|
||||
mainLayout->addWidget( guiPrioBox );
|
||||
|
||||
hbox = new QHBoxLayout();
|
||||
timingDevSelBox = new QComboBox();
|
||||
timingDevSelBox->addItem( tr("NanoSleep") , 0 );
|
||||
|
||||
#ifdef __linux__
|
||||
timingDevSelBox->addItem( tr("Timer FD") , 1 );
|
||||
#endif
|
||||
hbox->addWidget( new QLabel( tr("Timing Mechanism:") ) );
|
||||
hbox->addWidget( timingDevSelBox );
|
||||
mainLayout->addLayout( hbox );
|
||||
|
||||
setLayout( mainLayout );
|
||||
|
||||
g_config->getOption( "SDL.SetSchedParam", &opt );
|
||||
|
@ -127,6 +139,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
updatePolicyBox();
|
||||
updateSliderLimits();
|
||||
updateSliderValues();
|
||||
updateTimingMech();
|
||||
|
||||
connect( emuSchedPolicyBox , SIGNAL(activated(int)) , this, SLOT(emuSchedPolicyChange(int)) );
|
||||
connect( emuSchedNiceSlider , SIGNAL(valueChanged(int)), this, SLOT(emuSchedNiceChange(int)) );
|
||||
|
@ -135,6 +148,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
connect( guiSchedNiceSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedNiceChange(int)) );
|
||||
connect( guiSchedPrioSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedPrioChange(int)) );
|
||||
connect( emuPrioCtlEna , SIGNAL(stateChanged(int)), this, SLOT(emuSchedCtlChange(int)) );
|
||||
connect( timingDevSelBox , SIGNAL(activated(int)) , this, SLOT(emuTimingMechChange(int)) );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
TimingConfDialog_t::~TimingConfDialog_t(void)
|
||||
|
@ -484,3 +498,37 @@ void TimingConfDialog_t::updateSliderLimits(void)
|
|||
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::emuTimingMechChange( int index )
|
||||
{
|
||||
int mode;
|
||||
|
||||
if ( consoleWindow == NULL )
|
||||
{
|
||||
return;
|
||||
}
|
||||
fceuWrapperLock();
|
||||
|
||||
mode = timingDevSelBox->itemData( index ).toInt();
|
||||
|
||||
setTimingMode( mode );
|
||||
|
||||
RefreshThrottleFPS();
|
||||
|
||||
g_config->setOption("SDL.EmuTimingMech", mode);
|
||||
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::updateTimingMech(void)
|
||||
{
|
||||
int mode = getTimingMode();
|
||||
|
||||
for (int j=0; j<timingDevSelBox->count(); j++)
|
||||
{
|
||||
if ( timingDevSelBox->itemData(j).toInt() == mode )
|
||||
{
|
||||
timingDevSelBox->setCurrentIndex( j );
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -41,11 +41,13 @@ class TimingConfDialog_t : public QDialog
|
|||
QSlider *guiSchedNiceSlider;
|
||||
QLabel *guiSchedPrioLabel;
|
||||
QLabel *guiSchedNiceLabel;
|
||||
QComboBox *timingDevSelBox;
|
||||
|
||||
private:
|
||||
void updatePolicyBox(void);
|
||||
void updateSliderLimits(void);
|
||||
void updateSliderValues(void);
|
||||
void updateTimingMech(void);
|
||||
void saveValues(void);
|
||||
|
||||
public slots:
|
||||
|
@ -58,5 +60,6 @@ class TimingConfDialog_t : public QDialog
|
|||
void guiSchedNiceChange( int val );
|
||||
void guiSchedPrioChange( int val );
|
||||
void guiSchedPolicyChange( int index );
|
||||
void emuTimingMechChange( int index );
|
||||
|
||||
};
|
||||
|
|
|
@ -322,6 +322,7 @@ InitConfig()
|
|||
config->addOption("_guiSchedPolicy" , "SDL.GuiSchedPolicy", 0);
|
||||
config->addOption("_guiSchedNice" , "SDL.GuiSchedNice" , 0);
|
||||
config->addOption("_guiSchedPrioRt" , "SDL.GuiSchedPrioRt", 40);
|
||||
config->addOption("_emuTimingMech" , "SDL.EmuTimingMech" , 0);
|
||||
|
||||
// fcm -> fm2 conversion
|
||||
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
||||
|
|
|
@ -737,6 +737,15 @@ int fceuWrapperInit( int argc, char *argv[] )
|
|||
g_config->getOption("SDL.SubtitleDisplay", &id);
|
||||
movieSubtitles = id ? true : false;
|
||||
}
|
||||
|
||||
// Emulation Timing Mechanism
|
||||
{
|
||||
int timingMode;
|
||||
|
||||
g_config->getOption("SDL.EmuTimingMech", &timingMode);
|
||||
|
||||
setTimingMode( timingMode );
|
||||
}
|
||||
|
||||
// load the hotkeys from the config life
|
||||
setHotKeys();
|
||||
|
|
|
@ -47,7 +47,7 @@ double getHighPrecTimeStamp(void)
|
|||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static char useTimerFD = 1;
|
||||
static char useTimerFD = 0;
|
||||
static int timerfd = -1;
|
||||
|
||||
static void setTimer( double hz )
|
||||
|
@ -83,7 +83,7 @@ static void setTimer( double hz )
|
|||
perror("timerfd_settime failed: ");
|
||||
}
|
||||
|
||||
printf("Timer Set: %li ns\n", ispec.it_value.tv_nsec );
|
||||
//printf("Timer Set: %li ns\n", ispec.it_value.tv_nsec );
|
||||
|
||||
Lasttime = getHighPrecTimeStamp();
|
||||
Nexttime = Lasttime + desired_frametime;
|
||||
|
@ -91,6 +91,25 @@ static void setTimer( double hz )
|
|||
}
|
||||
#endif
|
||||
|
||||
int getTimingMode(void)
|
||||
{
|
||||
#ifdef __linux__
|
||||
if ( useTimerFD )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setTimingMode( int mode )
|
||||
{
|
||||
#ifdef __linux__
|
||||
useTimerFD = (mode == 1);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* LOGMUL = exp(log(2) / 3)
|
||||
*
|
||||
* This gives us a value such that if we do x*=LOGMUL three times,
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
void RefreshThrottleFPS();
|
||||
// throttle.h
|
||||
int SpeedThrottle(void);
|
||||
void RefreshThrottleFPS(void);
|
||||
int getTimingMode(void);
|
||||
int setTimingMode(int mode);
|
||||
|
|
Loading…
Reference in New Issue