Added logic to initialize the video PAL combo box with proper config value at window creation.

This commit is contained in:
Matthew Budd 2020-07-11 22:37:29 -04:00
parent 3a6c861326
commit 35b0227809
3 changed files with 21 additions and 9 deletions

View File

@ -51,6 +51,8 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
regionSelect->addItem( tr("PAL") , 1 );
regionSelect->addItem( tr("Dendy"), 2 );
setComboBoxFromProperty( regionSelect, "SDL.PAL");
connect(regionSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(regionChanged(int)) );
hbox1 = new QHBoxLayout();
@ -128,6 +130,20 @@ void ConsoleVideoConfDialog_t::setCheckBoxFromProperty( QCheckBox *cbx, const c
cbx->setCheckState( pval ? Qt::Checked : Qt::Unchecked );
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::setComboBoxFromProperty( QComboBox *cbx, const char *property )
{
int i, pval;
g_config->getOption (property, &pval);
for (i=0; i<cbx->count(); i++)
{
if ( pval == cbx->itemData(i).toInt() )
{
cbx->setCurrentIndex(i); break;
}
}
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::use_new_PPU_changed( int value )
{
//printf("Value:%i \n", value );
@ -196,7 +212,7 @@ void ConsoleVideoConfDialog_t::regionChanged(int index)
// reset sound subsystem for changes to take effect
fceuWrapperLock();
FCEUI_SetRegion (region);
FCEUI_SetRegion (region, true);
fceuWrapperUnLock();
}
//----------------------------------------------------

View File

@ -35,7 +35,7 @@ class ConsoleVideoConfDialog_t : public QDialog
QCheckBox *showFPS_cbx;
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
//void setComboBoxFromProperty( QComboBox *cbx, const char *property );
void setComboBoxFromProperty( QComboBox *cbx, const char *property );
//void setSliderFromProperty( QSlider *slider, QLabel *lbl, const char *property );
void resetVideo(void);

View File

@ -1054,38 +1054,34 @@ void FCEUI_SetRegion(int region, int notify) {
normalscanlines = 240;
pal_emulation = 0;
dendy = 0;
// until it's fixed on sdl. see issue #740
#ifdef WIN32
if (notify)
{
FCEU_DispMessage("NTSC mode set", 0);
FCEUI_printf("NTSC mode set");
}
#endif
break;
case 1: // PAL
normalscanlines = 240;
pal_emulation = 1;
dendy = 0;
#ifdef WIN32
if (notify)
{
FCEU_DispMessage("PAL mode set", 0);
FCEUI_printf("PAL mode set");
}
#endif
break;
case 2: // Dendy
normalscanlines = 290;
pal_emulation = 0;
dendy = 1;
#ifdef WIN32
if (notify)
{
FCEU_DispMessage("Dendy mode set", 0);
FCEUI_printf("Dendy mode set");
}
#endif
break;
}
normalscanlines += newppu;