From 35b0227809aee070ce4ecdfdcb2c6df57981ca6f Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Sat, 11 Jul 2020 22:37:29 -0400 Subject: [PATCH] Added logic to initialize the video PAL combo box with proper config value at window creation. --- src/drivers/Qt/ConsoleVideoConf.cpp | 18 +++++++++++++++++- src/drivers/Qt/ConsoleVideoConf.h | 2 +- src/fceu.cpp | 10 +++------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/drivers/Qt/ConsoleVideoConf.cpp b/src/drivers/Qt/ConsoleVideoConf.cpp index a70bdca2..05104e20 100644 --- a/src/drivers/Qt/ConsoleVideoConf.cpp +++ b/src/drivers/Qt/ConsoleVideoConf.cpp @@ -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; icount(); 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(); } //---------------------------------------------------- diff --git a/src/drivers/Qt/ConsoleVideoConf.h b/src/drivers/Qt/ConsoleVideoConf.h index 16b5aa5f..e27d59c0 100644 --- a/src/drivers/Qt/ConsoleVideoConf.h +++ b/src/drivers/Qt/ConsoleVideoConf.h @@ -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); diff --git a/src/fceu.cpp b/src/fceu.cpp index bb311c6c..96aa9a5d 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -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;