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/input.h"
|
||||||
#include "Qt/config.h"
|
#include "Qt/config.h"
|
||||||
#include "Qt/keyscan.h"
|
#include "Qt/keyscan.h"
|
||||||
|
#include "Qt/throttle.h"
|
||||||
#include "Qt/fceuWrapper.h"
|
#include "Qt/fceuWrapper.h"
|
||||||
#include "Qt/ConsoleWindow.h"
|
#include "Qt/ConsoleWindow.h"
|
||||||
#include "Qt/TimingConf.h"
|
#include "Qt/TimingConf.h"
|
||||||
|
@ -61,7 +62,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
QVBoxLayout *mainLayout;
|
QVBoxLayout *mainLayout;
|
||||||
//QHBoxLayout *hbox;
|
QHBoxLayout *hbox;
|
||||||
QGridLayout *grid;
|
QGridLayout *grid;
|
||||||
QGroupBox *emuPrioBox, *guiPrioBox;
|
QGroupBox *emuPrioBox, *guiPrioBox;
|
||||||
|
|
||||||
|
@ -118,6 +119,17 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
||||||
|
|
||||||
mainLayout->addWidget( guiPrioBox );
|
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 );
|
setLayout( mainLayout );
|
||||||
|
|
||||||
g_config->getOption( "SDL.SetSchedParam", &opt );
|
g_config->getOption( "SDL.SetSchedParam", &opt );
|
||||||
|
@ -127,6 +139,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
||||||
updatePolicyBox();
|
updatePolicyBox();
|
||||||
updateSliderLimits();
|
updateSliderLimits();
|
||||||
updateSliderValues();
|
updateSliderValues();
|
||||||
|
updateTimingMech();
|
||||||
|
|
||||||
connect( emuSchedPolicyBox , SIGNAL(activated(int)) , this, SLOT(emuSchedPolicyChange(int)) );
|
connect( emuSchedPolicyBox , SIGNAL(activated(int)) , this, SLOT(emuSchedPolicyChange(int)) );
|
||||||
connect( emuSchedNiceSlider , SIGNAL(valueChanged(int)), this, SLOT(emuSchedNiceChange(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( guiSchedNiceSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedNiceChange(int)) );
|
||||||
connect( guiSchedPrioSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedPrioChange(int)) );
|
connect( guiSchedPrioSlider , SIGNAL(valueChanged(int)), this, SLOT(guiSchedPrioChange(int)) );
|
||||||
connect( emuPrioCtlEna , SIGNAL(stateChanged(int)), this, SLOT(emuSchedCtlChange(int)) );
|
connect( emuPrioCtlEna , SIGNAL(stateChanged(int)), this, SLOT(emuSchedCtlChange(int)) );
|
||||||
|
connect( timingDevSelBox , SIGNAL(activated(int)) , this, SLOT(emuTimingMechChange(int)) );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
TimingConfDialog_t::~TimingConfDialog_t(void)
|
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;
|
QSlider *guiSchedNiceSlider;
|
||||||
QLabel *guiSchedPrioLabel;
|
QLabel *guiSchedPrioLabel;
|
||||||
QLabel *guiSchedNiceLabel;
|
QLabel *guiSchedNiceLabel;
|
||||||
|
QComboBox *timingDevSelBox;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updatePolicyBox(void);
|
void updatePolicyBox(void);
|
||||||
void updateSliderLimits(void);
|
void updateSliderLimits(void);
|
||||||
void updateSliderValues(void);
|
void updateSliderValues(void);
|
||||||
|
void updateTimingMech(void);
|
||||||
void saveValues(void);
|
void saveValues(void);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -58,5 +60,6 @@ class TimingConfDialog_t : public QDialog
|
||||||
void guiSchedNiceChange( int val );
|
void guiSchedNiceChange( int val );
|
||||||
void guiSchedPrioChange( int val );
|
void guiSchedPrioChange( int val );
|
||||||
void guiSchedPolicyChange( int index );
|
void guiSchedPolicyChange( int index );
|
||||||
|
void emuTimingMechChange( int index );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -322,6 +322,7 @@ InitConfig()
|
||||||
config->addOption("_guiSchedPolicy" , "SDL.GuiSchedPolicy", 0);
|
config->addOption("_guiSchedPolicy" , "SDL.GuiSchedPolicy", 0);
|
||||||
config->addOption("_guiSchedNice" , "SDL.GuiSchedNice" , 0);
|
config->addOption("_guiSchedNice" , "SDL.GuiSchedNice" , 0);
|
||||||
config->addOption("_guiSchedPrioRt" , "SDL.GuiSchedPrioRt", 40);
|
config->addOption("_guiSchedPrioRt" , "SDL.GuiSchedPrioRt", 40);
|
||||||
|
config->addOption("_emuTimingMech" , "SDL.EmuTimingMech" , 0);
|
||||||
|
|
||||||
// fcm -> fm2 conversion
|
// fcm -> fm2 conversion
|
||||||
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
||||||
|
|
|
@ -738,6 +738,15 @@ int fceuWrapperInit( int argc, char *argv[] )
|
||||||
movieSubtitles = id ? true : false;
|
movieSubtitles = id ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Emulation Timing Mechanism
|
||||||
|
{
|
||||||
|
int timingMode;
|
||||||
|
|
||||||
|
g_config->getOption("SDL.EmuTimingMech", &timingMode);
|
||||||
|
|
||||||
|
setTimingMode( timingMode );
|
||||||
|
}
|
||||||
|
|
||||||
// load the hotkeys from the config life
|
// load the hotkeys from the config life
|
||||||
setHotKeys();
|
setHotKeys();
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ double getHighPrecTimeStamp(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
static char useTimerFD = 1;
|
static char useTimerFD = 0;
|
||||||
static int timerfd = -1;
|
static int timerfd = -1;
|
||||||
|
|
||||||
static void setTimer( double hz )
|
static void setTimer( double hz )
|
||||||
|
@ -83,7 +83,7 @@ static void setTimer( double hz )
|
||||||
perror("timerfd_settime failed: ");
|
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();
|
Lasttime = getHighPrecTimeStamp();
|
||||||
Nexttime = Lasttime + desired_frametime;
|
Nexttime = Lasttime + desired_frametime;
|
||||||
|
@ -91,6 +91,25 @@ static void setTimer( double hz )
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
/* LOGMUL = exp(log(2) / 3)
|
||||||
*
|
*
|
||||||
* This gives us a value such that if we do x*=LOGMUL three times,
|
* 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);
|
int SpeedThrottle(void);
|
||||||
|
void RefreshThrottleFPS(void);
|
||||||
|
int getTimingMode(void);
|
||||||
|
int setTimingMode(int mode);
|
||||||
|
|
Loading…
Reference in New Issue