Added PPU overclocking feature to Qt GUI.
This commit is contained in:
parent
a9f6dafa15
commit
b97b652df7
|
@ -20,6 +20,7 @@
|
|||
// ConsoleVideoConf.cpp
|
||||
//
|
||||
#include <QCloseEvent>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "../../fceu.h"
|
||||
#include "Qt/main.h"
|
||||
|
@ -189,8 +190,8 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
}
|
||||
}
|
||||
|
||||
connect(new_PPU_ena , SIGNAL(clicked(bool)) , this, SLOT(use_new_PPU_changed(bool)) );
|
||||
connect(autoRegion , SIGNAL(stateChanged(int)), this, SLOT(autoRegionChanged(int)) );
|
||||
connect(new_PPU_ena , SIGNAL(stateChanged(int)), this, SLOT(use_new_PPU_changed(int)) );
|
||||
connect(frmskipcbx , SIGNAL(stateChanged(int)), this, SLOT(frameskip_changed(int)) );
|
||||
connect(sprtLimCbx , SIGNAL(stateChanged(int)), this, SLOT(useSpriteLimitChanged(int)) );
|
||||
connect(clipSidesCbx , SIGNAL(stateChanged(int)), this, SLOT(clipSidesChanged(int)) );
|
||||
|
@ -662,13 +663,43 @@ void ConsoleVideoConfDialog_t::autoRegionChanged( int value )
|
|||
g_config->save ();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::use_new_PPU_changed( int value )
|
||||
void ConsoleVideoConfDialog_t::use_new_PPU_changed( bool value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
g_config->setOption("SDL.NewPPU", (value == Qt::Checked) );
|
||||
bool reqNewPPU;
|
||||
|
||||
reqNewPPU = value;
|
||||
|
||||
if ( reqNewPPU )
|
||||
{
|
||||
if ( overclock_enabled )
|
||||
{
|
||||
QMessageBox::StandardButton ret;
|
||||
const char *msg = "The new PPU does not support overclocking. This will be disabled. Do you wish to continue?";
|
||||
|
||||
ret = QMessageBox::question( this, tr("Overclocking"), tr(msg) );
|
||||
|
||||
if ( ret == QMessageBox::No )
|
||||
{
|
||||
//printf("Skipping New PPU Activation\n");
|
||||
new_PPU_ena->setChecked(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//printf("NEW PPU Value:%i \n", reqNewPPU );
|
||||
fceuWrapperLock();
|
||||
|
||||
newppu = reqNewPPU;
|
||||
|
||||
if ( newppu )
|
||||
{
|
||||
overclock_enabled = 0;
|
||||
}
|
||||
|
||||
g_config->setOption("SDL.NewPPU", newppu );
|
||||
g_config->save ();
|
||||
|
||||
fceuWrapperLock();
|
||||
UpdateEMUCore (g_config);
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ class ConsoleVideoConfDialog_t : public QDialog
|
|||
void openGL_linearFilterChanged( int value );
|
||||
void autoScaleChanged( int value );
|
||||
void aspectEnableChanged( int value );
|
||||
void use_new_PPU_changed( int value );
|
||||
void use_new_PPU_changed( bool value );
|
||||
void frameskip_changed( int value );
|
||||
void useSpriteLimitChanged( int value );
|
||||
void clipSidesChanged( int value );
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <QHeaderView>
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "fceu.h"
|
||||
#include "Qt/main.h"
|
||||
#include "Qt/dface.h"
|
||||
#include "Qt/input.h"
|
||||
|
@ -85,7 +86,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
: QDialog(parent)
|
||||
{
|
||||
int opt;
|
||||
QVBoxLayout *mainLayout;
|
||||
QVBoxLayout *mainLayout, *vbox;
|
||||
QHBoxLayout *hbox;
|
||||
QGridLayout *grid;
|
||||
QPushButton *closeButton;
|
||||
|
@ -188,6 +189,33 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
hbox->addWidget(timingDevSelBox);
|
||||
mainLayout->addLayout(hbox);
|
||||
|
||||
vbox = new QVBoxLayout();
|
||||
grid = new QGridLayout();
|
||||
ppuOverClockBox = new QGroupBox( tr("Overclocking (Old PPU Only)") );
|
||||
ppuOverClockBox->setCheckable(true);
|
||||
ppuOverClockBox->setChecked(overclock_enabled);
|
||||
ppuOverClockBox->setEnabled(!newppu);
|
||||
ppuOverClockBox->setLayout(vbox);
|
||||
mainLayout->addWidget( ppuOverClockBox );
|
||||
|
||||
postRenderBox = new QSpinBox();
|
||||
vblankScanlinesBox = new QSpinBox();
|
||||
no7bitSamples = new QCheckBox( tr("Don't Overclock 7-bit Samples") );
|
||||
|
||||
postRenderBox->setRange(0, 999);
|
||||
vblankScanlinesBox->setRange(0, 999);
|
||||
|
||||
postRenderBox->setValue( postrenderscanlines );
|
||||
vblankScanlinesBox->setValue( vblankscanlines );
|
||||
no7bitSamples->setChecked( skip_7bit_overclocking );
|
||||
|
||||
vbox->addLayout( grid );
|
||||
grid->addWidget( new QLabel( tr("Post-render") ), 0, 0 );
|
||||
grid->addWidget( new QLabel( tr("Vblank Scanlines") ), 1, 0 );
|
||||
grid->addWidget( postRenderBox, 0, 1 );
|
||||
grid->addWidget( vblankScanlinesBox, 1, 1 );
|
||||
vbox->addWidget( no7bitSamples );
|
||||
|
||||
closeButton = new QPushButton( tr("Close") );
|
||||
closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
||||
connect(closeButton, SIGNAL(clicked(void)), this, SLOT(closeWindow(void)));
|
||||
|
@ -207,6 +235,7 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
updateSliderLimits();
|
||||
updateSliderValues();
|
||||
updateTimingMech();
|
||||
updateOverclocking();
|
||||
|
||||
#ifdef WIN32
|
||||
connect(emuSchedPrioBox, SIGNAL(activated(int)), this, SLOT(emuSchedPrioChange(int)));
|
||||
|
@ -221,11 +250,23 @@ TimingConfDialog_t::TimingConfDialog_t(QWidget *parent)
|
|||
#endif
|
||||
connect(emuPrioCtlEna, SIGNAL(stateChanged(int)), this, SLOT(emuSchedCtlChange(int)));
|
||||
connect(timingDevSelBox, SIGNAL(activated(int)), this, SLOT(emuTimingMechChange(int)));
|
||||
|
||||
connect( ppuOverClockBox , SIGNAL(toggled(bool)) , this, SLOT(overclockingToggled(bool)));
|
||||
connect( postRenderBox , SIGNAL(valueChanged(int)), this, SLOT(postRenderChanged(int)));
|
||||
connect( vblankScanlinesBox, SIGNAL(valueChanged(int)), this, SLOT(vblankScanlinesChanged(int)));
|
||||
connect( no7bitSamples , SIGNAL(stateChanged(int)), this, SLOT(no7bitChanged(int)));
|
||||
|
||||
updateTimer = new QTimer( this );
|
||||
|
||||
connect( updateTimer, &QTimer::timeout, this, &TimingConfDialog_t::periodicUpdate );
|
||||
|
||||
updateTimer->start( 500 ); // 2Hz
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
TimingConfDialog_t::~TimingConfDialog_t(void)
|
||||
{
|
||||
printf("Destroy Timing Config Window\n");
|
||||
updateTimer->stop();
|
||||
saveValues();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -244,6 +285,12 @@ void TimingConfDialog_t::closeWindow(void)
|
|||
deleteLater();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::periodicUpdate(void)
|
||||
{
|
||||
updateOverclocking();
|
||||
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::emuSchedCtlChange(int state)
|
||||
{
|
||||
g_config->setOption("SDL.SetSchedParam", (state != Qt::Unchecked));
|
||||
|
@ -654,3 +701,43 @@ void TimingConfDialog_t::updateTimingMech(void)
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::overclockingToggled(bool on)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
if ( !newppu )
|
||||
{
|
||||
overclock_enabled = on;
|
||||
}
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::postRenderChanged(int value)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
postrenderscanlines = value;
|
||||
fceuWrapperUnLock();
|
||||
//printf("Post Render %i\n", postrenderscanlines );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::vblankScanlinesChanged(int value)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
vblankscanlines = value;
|
||||
fceuWrapperUnLock();
|
||||
//printf("Vblank Scanlines %i\n", vblankscanlines );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::no7bitChanged(int value)
|
||||
{
|
||||
fceuWrapperLock();
|
||||
skip_7bit_overclocking = (value != Qt::Unchecked);
|
||||
fceuWrapperUnLock();
|
||||
//printf("Skip 7-bit: %i\n", skip_7bit_overclocking );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
void TimingConfDialog_t::updateOverclocking(void)
|
||||
{
|
||||
ppuOverClockBox->setEnabled( !newppu );
|
||||
ppuOverClockBox->setChecked( overclock_enabled );
|
||||
}
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <QSlider>
|
||||
#include <QFrame>
|
||||
#include <QGroupBox>
|
||||
#include <QSpinBox>
|
||||
#include <QTreeView>
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
@ -48,16 +49,25 @@ protected:
|
|||
#endif
|
||||
QComboBox *timingDevSelBox;
|
||||
|
||||
QGroupBox *ppuOverClockBox;
|
||||
QSpinBox *postRenderBox;
|
||||
QSpinBox *vblankScanlinesBox;
|
||||
QCheckBox *no7bitSamples;
|
||||
|
||||
QTimer *updateTimer;
|
||||
|
||||
private:
|
||||
void updatePolicyBox(void);
|
||||
void updateSliderLimits(void);
|
||||
void updateSliderValues(void);
|
||||
void updateTimingMech(void);
|
||||
void updateOverclocking(void);
|
||||
void saveValues(void);
|
||||
|
||||
public slots:
|
||||
void closeWindow(void);
|
||||
private slots:
|
||||
void periodicUpdate(void);
|
||||
void emuSchedCtlChange(int state);
|
||||
void emuSchedNiceChange(int val);
|
||||
void emuSchedPrioChange(int val);
|
||||
|
@ -66,4 +76,8 @@ private slots:
|
|||
void guiSchedPrioChange(int val);
|
||||
void guiSchedPolicyChange(int index);
|
||||
void emuTimingMechChange(int index);
|
||||
void overclockingToggled(bool on);
|
||||
void postRenderChanged(int value);
|
||||
void vblankScanlinesChanged(int value);
|
||||
void no7bitChanged(int value);
|
||||
};
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "Qt/throttle.h"
|
||||
#include "Qt/config.h"
|
||||
|
||||
#include "fceu.h"
|
||||
#include "../common/cheat.h"
|
||||
|
||||
#include "Qt/input.h"
|
||||
|
@ -841,6 +842,8 @@ UpdateEMUCore(Config *config)
|
|||
LoadCPalette(cpalette);
|
||||
}
|
||||
|
||||
config->getOption("SDL.NewPPU", &newppu);
|
||||
|
||||
config->getOption("SDL.PAL", ®ion);
|
||||
FCEUI_SetRegion(region);
|
||||
|
||||
|
|
|
@ -961,13 +961,7 @@ int fceuWrapperInit( int argc, char *argv[] )
|
|||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
int id;
|
||||
g_config->getOption("SDL.NewPPU", &id);
|
||||
if (id)
|
||||
newppu = 1;
|
||||
}
|
||||
|
||||
g_config->getOption("SDL.NewPPU", &newppu);
|
||||
g_config->getOption("SDL.Frameskip", &frameskip);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue