Modified Qt video settings window to group video overlays together. Added frame, lag, and re-record count overlays checkbox options to window. Added input display overlay combo box.

This commit is contained in:
mjbudd77 2021-08-09 22:06:45 -04:00
parent 8d4e535d0a
commit 49534e8f4b
4 changed files with 128 additions and 5 deletions

View File

@ -23,6 +23,8 @@
#include <QMessageBox>
#include "../../fceu.h"
#include "../../input.h"
#include "../../video.h"
#include "Qt/main.h"
#include "Qt/dface.h"
#include "Qt/config.h"
@ -33,11 +35,14 @@
#include "Qt/ConsoleVideoConf.h"
#include "Qt/nes_shm.h"
extern int input_display;
extern int frame_display;
extern int rerecord_display;
//----------------------------------------------------
ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
: QDialog( parent )
{
QVBoxLayout *main_vbox, *vbox1, *vbox2, *vbox;
QVBoxLayout *main_vbox, *vbox1, *vbox2, *vbox3, *vbox4, *vbox;
QHBoxLayout *main_hbox, *hbox1, *hbox;
QLabel *lbl;
QPushButton *button;
@ -160,7 +165,19 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
clipSidesCbx = new QCheckBox( tr("Clip Left/Right Sides (8 px on each)") );
// Show FPS Checkbox
showFPS_cbx = new QCheckBox( tr("Show FPS") );
showFPS_cbx = new QCheckBox( tr("Frames Per Second") );
// Show Frame Count Checkbox
showFrameCount_cbx = new QCheckBox( tr("Frame Count") );
showFrameCount_cbx->setChecked( frame_display );
// Show Lag Count Checkbox
showLagCount_cbx = new QCheckBox( tr("Lag Count") );
showLagCount_cbx->setChecked( lagCounterDisplay );
// Show Re-Record Count Checkbox
showRerecordCount_cbx = new QCheckBox( tr("Re-Record Count") );
showRerecordCount_cbx->setChecked( rerecord_display );
// Auto Scale on Resize
autoScaleCbx = new QCheckBox( tr("Auto Scale on Resize") );
@ -171,6 +188,16 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
// Draw Input Aids
drawInputAidsCbx = new QCheckBox( tr("Draw Input Aids") );
// Input Display Select
inputDisplaySel = new QComboBox();
inputDisplaySel->addItem( tr("None"), 0 );
inputDisplaySel->addItem( tr("GP 1"), 1 );
inputDisplaySel->addItem( tr("GPs 1 & 2"), 2 );
inputDisplaySel->addItem( tr("GPs 1, 2, & 4"), 4 );
setComboBoxFromProperty( inputDisplaySel , "SDL.InputDisplay");
setCheckBoxFromProperty( autoRegion , "SDL.AutoDetectPAL");
setCheckBoxFromProperty( new_PPU_ena , "SDL.NewPPU");
setCheckBoxFromProperty( frmskipcbx , "SDL.Frameskip");
@ -205,13 +232,19 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
connect(autoScaleCbx , SIGNAL(stateChanged(int)), this, SLOT(autoScaleChanged(int)) );
connect(drawInputAidsCbx, SIGNAL(stateChanged(int)), this, SLOT(drawInputAidsChanged(int)) );
connect( showFrameCount_cbx, SIGNAL(stateChanged(int)), this, SLOT(showFrameCountChanged(int)) );
connect( showLagCount_cbx, SIGNAL(stateChanged(int)), this, SLOT(showLagCountChanged(int)) );
connect(showRerecordCount_cbx, SIGNAL(stateChanged(int)), this, SLOT(showRerecordCountChanged(int)));
connect(inputDisplaySel, SIGNAL(currentIndexChanged(int)), this, SLOT(inputDisplayChanged(int)) );
vbox1->addWidget( autoRegion );
vbox1->addWidget( new_PPU_ena );
vbox1->addWidget( frmskipcbx );
vbox1->addWidget( intFrameRateCbx );
vbox1->addWidget( sprtLimCbx );
vbox1->addWidget( drawInputAidsCbx );
vbox1->addWidget( showFPS_cbx );
//vbox1->addWidget( drawInputAidsCbx );
//vbox1->addWidget( showFPS_cbx );
vbox1->addWidget( autoScaleCbx);
vbox1->addWidget( aspectCbx );
@ -303,10 +336,31 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
main_vbox->addLayout( hbox1 );
gbox = new QGroupBox( tr("Overlay Options") );
vbox3 = new QVBoxLayout();
vbox4 = new QVBoxLayout();
vbox = new QVBoxLayout();
vbox3->addWidget( gbox, 1 );
vbox3->addStretch(5);
gbox->setLayout( vbox );
vbox->addWidget( drawInputAidsCbx );
vbox->addWidget( showFPS_cbx );
vbox->addWidget( showFrameCount_cbx );
vbox->addWidget( showLagCount_cbx );
vbox->addWidget( showRerecordCount_cbx );
gbox = new QGroupBox( tr("Input Display:") );
gbox->setLayout( vbox4 );
vbox->addWidget( gbox );
vbox4->addWidget( inputDisplaySel );
gbox = new QGroupBox( tr("Drawing Area") );
vbox2 = new QVBoxLayout();
grid = new QGridLayout();
main_hbox->addLayout( vbox3 );
main_hbox->addLayout( vbox2 );
vbox2->addWidget( gbox, 1 );
gbox->setLayout(grid);
@ -755,6 +809,7 @@ void ConsoleVideoConfDialog_t::showFPSChanged( int value )
g_config->save ();
fceuWrapperLock();
FCEUI_SetShowFPS( (value == Qt::Checked) );
UpdateEMUCore (g_config);
fceuWrapperUnLock();
}
@ -837,6 +892,17 @@ void ConsoleVideoConfDialog_t::regionChanged(int index)
}
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::inputDisplayChanged(int index)
{
//printf("Scaler: %i : %i \n", index, scalerSelect->itemData(index).toInt() );
fceuWrapperLock();
input_display = inputDisplaySel->itemData(index).toInt();
fceuWrapperUnLock();
g_config->setOption ("SDL.InputDisplay", input_display);
g_config->save ();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::aspectChanged(int index)
{
int aspectID;
@ -886,7 +952,45 @@ void ConsoleVideoConfDialog_t::drawInputAidsChanged( int value )
g_config->setOption("SDL.DrawInputAids", draw );
g_config->save ();
fceuWrapperLock();
drawInputAidsEnable = draw;
fceuWrapperUnLock();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showFrameCountChanged( int value )
{
fceuWrapperLock();
frame_display = (value != Qt::Unchecked);
fceuWrapperUnLock();
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowFrameCount", frame_display );
g_config->save ();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showLagCountChanged( int value )
{
fceuWrapperLock();
lagCounterDisplay = (value != Qt::Unchecked);
fceuWrapperUnLock();
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowLagCount", lagCounterDisplay );
g_config->save ();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showRerecordCountChanged( int value )
{
fceuWrapperLock();
rerecord_display = (value != Qt::Unchecked);
fceuWrapperUnLock();
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowRerecordCount", rerecord_display );
g_config->save ();
}
//----------------------------------------------------
QSize ConsoleVideoConfDialog_t::calcNewScreenSize(void)

View File

@ -36,6 +36,7 @@ class ConsoleVideoConfDialog_t : public QDialog
QComboBox *regionSelect;
QComboBox *cursorSelect;
QComboBox *aspectSelect;
QComboBox *inputDisplaySel;
QCheckBox *autoRegion;
QCheckBox *gl_LF_chkBox;
QCheckBox *new_PPU_ena;
@ -48,6 +49,9 @@ class ConsoleVideoConfDialog_t : public QDialog
QCheckBox *cursorVisCbx;
QCheckBox *drawInputAidsCbx;
QCheckBox *intFrameRateCbx;
QCheckBox *showFrameCount_cbx;
QCheckBox *showLagCount_cbx;
QCheckBox *showRerecordCount_cbx;
QDoubleSpinBox *xScaleBox;
QDoubleSpinBox *yScaleBox;
QLabel *aspectSelectLabel;
@ -91,6 +95,10 @@ class ConsoleVideoConfDialog_t : public QDialog
void cursorShapeChanged(int index);
void cursorVisChanged(int value);
void drawInputAidsChanged(int value);
void showFrameCountChanged(int value);
void showLagCountChanged( int value );
void showRerecordCountChanged( int value );
void inputDisplayChanged(int index);
void applyChanges( void );
void ntscStartScanLineChanged(int value);
void ntscEndScanLineChanged(int value);

View File

@ -545,6 +545,9 @@ InitConfig()
config->addOption("cursorType", "SDL.CursorType", 0);
config->addOption("cursorVis" , "SDL.CursorVis", 1);
config->addOption("SDL.DrawInputAids", 1);
config->addOption("SDL.ShowFrameCount", 0);
config->addOption("SDL.ShowLagCount", 0);
config->addOption("SDL.ShowRerecordCount", 0);
// OpenGL options
config->addOption("opengl", "SDL.OpenGL", 1);

View File

@ -27,6 +27,7 @@
#include "../../fceu.h"
#include "../../version.h"
#include "../../video.h"
#include "../../input.h"
#include "utils/memory.h"
@ -71,6 +72,9 @@ static int initBlitToHighDone = 0;
static int s_paletterefresh = 1;
extern bool MaxSpeed;
extern int input_display;
extern int frame_display;
extern int rerecord_display;
/**
* Attempts to destroy the graphical video display. Returns 0 on
@ -199,7 +203,8 @@ void CalcVideoDimensions(void)
int InitVideo(FCEUGI *gi)
{
int doublebuf, xstretch, ystretch, xres, yres, show_fps;
int doublebuf, xstretch, ystretch, xres, yres;
int show_fps;
int startNTSC, endNTSC, startPAL, endPAL;
FCEUI_printf("Initializing video...");
@ -215,6 +220,9 @@ int InitVideo(FCEUGI *gi)
g_config->getOption("SDL.ClipSides", &s_clipSides);
g_config->getOption("SDL.NoFrame", &noframe);
g_config->getOption("SDL.ShowFPS", &show_fps);
g_config->getOption("SDL.ShowFrameCount", &frame_display);
g_config->getOption("SDL.ShowLagCount", &lagCounterDisplay);
g_config->getOption("SDL.ShowRerecordCount", &rerecord_display);
//g_config->getOption("SDL.XScale", &s_exs);
//g_config->getOption("SDL.YScale", &s_eys);
g_config->getOption("SDL.ScanLineStartNTSC", &startNTSC);