Merge branch 'master' into gp-function_binding
This commit is contained in:
commit
3836e03f53
|
@ -175,7 +175,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src )
|
|||
include_directories( ${CMAKE_SOURCE_DIR}/src/drivers )
|
||||
|
||||
if(APPLE)
|
||||
add_definitions( -DPSS_STYLE=4 )
|
||||
add_definitions( -DPSS_STYLE=1 )
|
||||
else(APPLE)
|
||||
if(UNIX)
|
||||
add_definitions( -DPSS_STYLE=1 )
|
||||
|
|
|
@ -53,8 +53,8 @@ void Mirror(uint8 value)
|
|||
|
||||
static void Sync()
|
||||
{
|
||||
int prglo;
|
||||
int prghi;
|
||||
int prglo = 0;
|
||||
int prghi = 0;
|
||||
|
||||
int outb = outer << 1;
|
||||
//this can probably be rolled up, but i have no motivation to do so
|
||||
|
|
|
@ -161,8 +161,8 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
// Auto Scale on Resize
|
||||
autoScaleCbx = new QCheckBox( tr("Auto Scale on Resize") );
|
||||
|
||||
// Square Pixels
|
||||
sqrPixCbx = new QCheckBox( tr("Square Pixels") );
|
||||
// Force Aspect Ratio
|
||||
aspectCbx = new QCheckBox( tr("Force Aspect Ratio") );
|
||||
|
||||
setCheckBoxFromProperty( autoRegion , "SDL.AutoDetectPAL");
|
||||
setCheckBoxFromProperty( new_PPU_ena , "SDL.NewPPU");
|
||||
|
@ -176,12 +176,12 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
autoScaleCbx->setChecked( consoleWindow->viewport_GL->getAutoScaleOpt() );
|
||||
sqrPixCbx->setChecked( consoleWindow->viewport_GL->getSqrPixelOpt() );
|
||||
aspectCbx->setChecked( consoleWindow->viewport_GL->getForceAspectOpt() );
|
||||
}
|
||||
else if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
autoScaleCbx->setChecked( consoleWindow->viewport_SDL->getAutoScaleOpt() );
|
||||
sqrPixCbx->setChecked( consoleWindow->viewport_SDL->getSqrPixelOpt() );
|
||||
aspectCbx->setChecked( consoleWindow->viewport_SDL->getForceAspectOpt() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
connect(sprtLimCbx , SIGNAL(stateChanged(int)), this, SLOT(useSpriteLimitChanged(int)) );
|
||||
connect(clipSidesCbx, SIGNAL(stateChanged(int)), this, SLOT(clipSidesChanged(int)) );
|
||||
connect(showFPS_cbx , SIGNAL(stateChanged(int)), this, SLOT(showFPSChanged(int)) );
|
||||
connect(sqrPixCbx , SIGNAL(stateChanged(int)), this, SLOT(sqrPixChanged(int)) );
|
||||
connect(aspectCbx , SIGNAL(stateChanged(int)), this, SLOT(aspectEnableChanged(int)) );
|
||||
connect(autoScaleCbx, SIGNAL(stateChanged(int)), this, SLOT(autoScaleChanged(int)) );
|
||||
|
||||
vbox1->addWidget( autoRegion );
|
||||
|
@ -201,7 +201,27 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
//vbox1->addWidget( clipSidesCbx);
|
||||
vbox1->addWidget( showFPS_cbx );
|
||||
vbox1->addWidget( autoScaleCbx);
|
||||
vbox1->addWidget( sqrPixCbx );
|
||||
vbox1->addWidget( aspectCbx );
|
||||
|
||||
aspectSelect = new QComboBox();
|
||||
|
||||
aspectSelect->addItem( tr("Default (1:1)"), 0 );
|
||||
aspectSelect->addItem( tr("NTSC (8:7)"), 1 );
|
||||
aspectSelect->addItem( tr("PAL (11:8)"), 2 );
|
||||
aspectSelect->addItem( tr("Standard (4:3)"), 3 );
|
||||
aspectSelect->addItem( tr("Widescreen (16:9)"), 4 );
|
||||
//aspectSelect->addItem( tr("Custom"), 5 ); TODO
|
||||
|
||||
setComboBoxFromProperty( aspectSelect, "SDL.AspectSelect");
|
||||
|
||||
connect(aspectSelect, SIGNAL(currentIndexChanged(int)), this, SLOT(aspectChanged(int)) );
|
||||
|
||||
aspectSelectLabel = new QLabel( tr("Aspect:") );
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
hbox1->addWidget( aspectSelectLabel );
|
||||
hbox1->addWidget( aspectSelect );
|
||||
vbox1->addLayout( hbox1 );
|
||||
|
||||
xScaleBox = new QDoubleSpinBox(this);
|
||||
yScaleBox = new QDoubleSpinBox(this);
|
||||
|
@ -226,7 +246,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
}
|
||||
}
|
||||
|
||||
if ( sqrPixCbx->isChecked() )
|
||||
if ( aspectCbx->isChecked() )
|
||||
{
|
||||
xScaleLabel = new QLabel( tr("Scale:") );
|
||||
}
|
||||
|
@ -246,11 +266,16 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
|
|||
hbox1->addWidget( yScaleBox );
|
||||
vbox1->addLayout( hbox1 );
|
||||
|
||||
if ( sqrPixCbx->isChecked() )
|
||||
if ( aspectCbx->isChecked() )
|
||||
{
|
||||
yScaleLabel->hide();
|
||||
yScaleBox->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
aspectSelectLabel->hide();
|
||||
aspectSelect->hide();
|
||||
}
|
||||
|
||||
hbox1 = new QHBoxLayout();
|
||||
|
||||
|
@ -684,22 +709,28 @@ void ConsoleVideoConfDialog_t::showFPSChanged( int value )
|
|||
fceuWrapperUnLock();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::sqrPixChanged( int value )
|
||||
void ConsoleVideoConfDialog_t::aspectEnableChanged( int value )
|
||||
{
|
||||
//printf("Value:%i \n", value );
|
||||
int useSqrPix = (value != Qt::Unchecked);
|
||||
int forceAspect = (value != Qt::Unchecked);
|
||||
|
||||
if ( useSqrPix )
|
||||
if ( forceAspect )
|
||||
{
|
||||
xScaleLabel->setText( tr("Scale:") );
|
||||
yScaleLabel->hide();
|
||||
yScaleBox->hide();
|
||||
|
||||
aspectSelectLabel->show();
|
||||
aspectSelect->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
xScaleLabel->setText( tr("X Scale:") );
|
||||
yScaleLabel->show();
|
||||
yScaleBox->show();
|
||||
|
||||
aspectSelectLabel->hide();
|
||||
aspectSelect->hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -750,6 +781,18 @@ void ConsoleVideoConfDialog_t::regionChanged(int index)
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::aspectChanged(int index)
|
||||
{
|
||||
int aspectID;
|
||||
|
||||
aspectID = aspectSelect->itemData(index).toInt();
|
||||
|
||||
g_config->setOption ("SDL.AspectSelect", aspectID);
|
||||
g_config->save ();
|
||||
|
||||
consoleWindow->setViewportAspect();
|
||||
}
|
||||
//----------------------------------------------------
|
||||
void ConsoleVideoConfDialog_t::cursorShapeChanged(int index)
|
||||
{
|
||||
int cursorSel;
|
||||
|
@ -784,7 +827,7 @@ QSize ConsoleVideoConfDialog_t::calcNewScreenSize(void)
|
|||
if ( consoleWindow )
|
||||
{
|
||||
QSize w, v;
|
||||
double xscale, yscale;
|
||||
double xscale = 1.0, yscale = 1.0, aspectRatio = 1.0;
|
||||
int texture_width = nes_shm->video.ncol;
|
||||
int texture_height = nes_shm->video.nrow;
|
||||
int l=0, r=texture_width;
|
||||
|
@ -796,19 +839,20 @@ QSize ConsoleVideoConfDialog_t::calcNewScreenSize(void)
|
|||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
v = consoleWindow->viewport_GL->size();
|
||||
aspectRatio = consoleWindow->viewport_GL->getAspectRatio();
|
||||
}
|
||||
else if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
v = consoleWindow->viewport_SDL->size();
|
||||
aspectRatio = consoleWindow->viewport_SDL->getAspectRatio();
|
||||
}
|
||||
|
||||
dw = w.width() - v.width();
|
||||
dh = w.height() - v.height();
|
||||
|
||||
if ( sqrPixCbx->isChecked() )
|
||||
if ( aspectCbx->isChecked() )
|
||||
{
|
||||
xscale = xScaleBox->value();
|
||||
|
||||
yscale = xscale * (double)nes_shm->video.xyRatio;
|
||||
}
|
||||
else
|
||||
|
@ -819,6 +863,21 @@ QSize ConsoleVideoConfDialog_t::calcNewScreenSize(void)
|
|||
rw=(int)((r-l)*xscale);
|
||||
rh=(int)((b-t)*yscale);
|
||||
|
||||
if ( aspectCbx->isChecked() )
|
||||
{
|
||||
double rr;
|
||||
|
||||
rr = (double)rh / (double)rw;
|
||||
|
||||
if ( rr > aspectRatio )
|
||||
{
|
||||
rw = (int)( (((double)rh) / aspectRatio) + 0.50);
|
||||
}
|
||||
else
|
||||
{
|
||||
rh = (int)( (((double)rw) * aspectRatio) + 0.50);
|
||||
}
|
||||
}
|
||||
out.setWidth( rw + dw );
|
||||
out.setHeight( rh + dh );
|
||||
}
|
||||
|
@ -834,7 +893,7 @@ void ConsoleVideoConfDialog_t::applyChanges( void )
|
|||
float xscale, yscale;
|
||||
QSize s = calcNewScreenSize();
|
||||
|
||||
if ( sqrPixCbx->isChecked() )
|
||||
if ( aspectCbx->isChecked() )
|
||||
{
|
||||
yscale = xscale = xScaleBox->value();
|
||||
}
|
||||
|
@ -846,13 +905,13 @@ void ConsoleVideoConfDialog_t::applyChanges( void )
|
|||
|
||||
if ( consoleWindow->viewport_GL )
|
||||
{
|
||||
consoleWindow->viewport_GL->setSqrPixelOpt( sqrPixCbx->isChecked() );
|
||||
consoleWindow->viewport_GL->setForceAspectOpt( aspectCbx->isChecked() );
|
||||
consoleWindow->viewport_GL->setAutoScaleOpt( autoScaleCbx->isChecked() );
|
||||
consoleWindow->viewport_GL->setScaleXY( xscale, yscale );
|
||||
}
|
||||
if ( consoleWindow->viewport_SDL )
|
||||
{
|
||||
consoleWindow->viewport_SDL->setSqrPixelOpt( sqrPixCbx->isChecked() );
|
||||
consoleWindow->viewport_SDL->setForceAspectOpt( aspectCbx->isChecked() );
|
||||
consoleWindow->viewport_SDL->setAutoScaleOpt( autoScaleCbx->isChecked() );
|
||||
consoleWindow->viewport_SDL->setScaleXY( xscale, yscale );
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ class ConsoleVideoConfDialog_t : public QDialog
|
|||
QComboBox *scalerSelect;
|
||||
QComboBox *regionSelect;
|
||||
QComboBox *cursorSelect;
|
||||
QComboBox *aspectSelect;
|
||||
QCheckBox *autoRegion;
|
||||
QCheckBox *gl_LF_chkBox;
|
||||
QCheckBox *new_PPU_ena;
|
||||
|
@ -42,10 +43,11 @@ class ConsoleVideoConfDialog_t : public QDialog
|
|||
QCheckBox *clipSidesCbx;
|
||||
QCheckBox *showFPS_cbx;
|
||||
QCheckBox *autoScaleCbx;
|
||||
QCheckBox *sqrPixCbx;
|
||||
QCheckBox *aspectCbx;
|
||||
QCheckBox *cursorVisCbx;
|
||||
QDoubleSpinBox *xScaleBox;
|
||||
QDoubleSpinBox *yScaleBox;
|
||||
QLabel *aspectSelectLabel;
|
||||
QLabel *xScaleLabel;
|
||||
QLabel *yScaleLabel;
|
||||
QLineEdit *ntsc_start;
|
||||
|
@ -71,12 +73,13 @@ class ConsoleVideoConfDialog_t : public QDialog
|
|||
void autoRegionChanged( int value );
|
||||
void openGL_linearFilterChanged( int value );
|
||||
void autoScaleChanged( int value );
|
||||
void sqrPixChanged( int value );
|
||||
void aspectEnableChanged( int value );
|
||||
void use_new_PPU_changed( int value );
|
||||
void frameskip_changed( int value );
|
||||
void useSpriteLimitChanged( int value );
|
||||
void clipSidesChanged( int value );
|
||||
void showFPSChanged( int value );
|
||||
void aspectChanged(int index);
|
||||
void regionChanged(int index);
|
||||
void driverChanged(int index);
|
||||
void scalerChanged(int index);
|
||||
|
|
|
@ -50,8 +50,11 @@ ConsoleViewGL_t::ConsoleViewGL_t(QWidget *parent)
|
|||
view_height = 0;
|
||||
gltexture = 0;
|
||||
devPixRatio = 1.0f;
|
||||
aspectRatio = 1.0f;
|
||||
aspectX = 1.0f;
|
||||
aspectY = 1.0f;
|
||||
linearFilter = false;
|
||||
sqrPixels = true;
|
||||
forceAspect = true;
|
||||
autoScaleEna = true;
|
||||
xscale = 2.0;
|
||||
yscale = 2.0;
|
||||
|
@ -201,7 +204,7 @@ void ConsoleViewGL_t::setScaleXY( double xs, double ys )
|
|||
xscale = xs;
|
||||
yscale = ys;
|
||||
|
||||
if ( sqrPixels )
|
||||
if ( forceAspect )
|
||||
{
|
||||
if ( (xscale*xyRatio) < yscale )
|
||||
{
|
||||
|
@ -214,6 +217,25 @@ void ConsoleViewGL_t::setScaleXY( double xs, double ys )
|
|||
}
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::setAspectXY( double x, double y )
|
||||
{
|
||||
aspectX = x;
|
||||
aspectY = y;
|
||||
|
||||
aspectRatio = aspectY / aspectX;
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::getAspectXY( double &x, double &y )
|
||||
{
|
||||
x = aspectX;
|
||||
y = aspectY;
|
||||
}
|
||||
|
||||
double ConsoleViewGL_t::getAspectRatio(void)
|
||||
{
|
||||
return aspectRatio;
|
||||
}
|
||||
|
||||
void ConsoleViewGL_t::transfer2LocalBuffer(void)
|
||||
{
|
||||
int i=0, hq = 0;
|
||||
|
@ -314,15 +336,15 @@ void ConsoleViewGL_t::paintGL(void)
|
|||
float xscaleTmp = (float)(view_width) / (float)(texture_width);
|
||||
float yscaleTmp = (float)(view_height) / (float)(texture_height);
|
||||
|
||||
if ( sqrPixels )
|
||||
if ( forceAspect )
|
||||
{
|
||||
if ( (xscaleTmp*xyRatio) < yscaleTmp )
|
||||
{
|
||||
yscaleTmp = (xscaleTmp*xyRatio);
|
||||
yscaleTmp = xscaleTmp * xyRatio;
|
||||
}
|
||||
else
|
||||
{
|
||||
xscaleTmp = (yscaleTmp/xyRatio);
|
||||
xscaleTmp = yscaleTmp / xyRatio;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -342,8 +364,45 @@ void ConsoleViewGL_t::paintGL(void)
|
|||
yscaleTmp = yscale;
|
||||
}
|
||||
}
|
||||
|
||||
rw=(int)((r-l)*xscaleTmp);
|
||||
rh=(int)((b-t)*yscaleTmp);
|
||||
|
||||
if ( forceAspect )
|
||||
{
|
||||
int iw, ih, ax, ay;
|
||||
|
||||
ax = (int)(aspectX+0.50);
|
||||
ay = (int)(aspectY+0.50);
|
||||
|
||||
iw = rw * ay;
|
||||
ih = rh * ax;
|
||||
|
||||
if ( iw > ih )
|
||||
{
|
||||
rh = (rw * ay) / ax;
|
||||
}
|
||||
else
|
||||
{
|
||||
rw = (rh * ax) / ay;
|
||||
}
|
||||
|
||||
if ( rw > view_width )
|
||||
{
|
||||
rw = view_width;
|
||||
rh = (rw * ay) / ax;
|
||||
}
|
||||
|
||||
if ( rh > view_height )
|
||||
{
|
||||
rh = view_height;
|
||||
rw = (rh * ax) / ay;
|
||||
}
|
||||
}
|
||||
|
||||
if ( rw > view_width ) rw = view_width;
|
||||
if ( rh > view_height) rh = view_height;
|
||||
|
||||
sx=(view_width-rw)/2;
|
||||
sy=(view_height-rh)/2;
|
||||
|
||||
|
|
|
@ -14,16 +14,16 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
|
||||
public:
|
||||
ConsoleViewGL_t(QWidget *parent = 0);
|
||||
~ConsoleViewGL_t(void);
|
||||
~ConsoleViewGL_t(void);
|
||||
|
||||
int init( void );
|
||||
|
||||
void transfer2LocalBuffer(void);
|
||||
|
||||
void setLinearFilterEnable( bool ena );
|
||||
void setLinearFilterEnable( bool ena );
|
||||
|
||||
bool getSqrPixelOpt(void){ return sqrPixels; };
|
||||
void setSqrPixelOpt( bool val ){ sqrPixels = val; return; };
|
||||
bool getForceAspectOpt(void){ return forceAspect; };
|
||||
void setForceAspectOpt( bool val ){ forceAspect = val; return; };
|
||||
bool getAutoScaleOpt(void){ return autoScaleEna; };
|
||||
void setAutoScaleOpt( bool val ){ autoScaleEna = val; return; };
|
||||
double getScaleX(void){ return xscale; };
|
||||
|
@ -31,9 +31,12 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
void setScaleXY( double xs, double ys );
|
||||
void getNormalizedCursorPos( double &x, double &y );
|
||||
bool getMouseButtonState( unsigned int btn );
|
||||
void setAspectXY( double x, double y );
|
||||
void getAspectXY( double &x, double &y );
|
||||
double getAspectRatio(void);
|
||||
|
||||
protected:
|
||||
void initializeGL(void);
|
||||
void initializeGL(void);
|
||||
void resizeGL(int w, int h);
|
||||
void paintGL(void);
|
||||
void mousePressEvent(QMouseEvent * event);
|
||||
|
@ -44,6 +47,9 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
void doRemap(void);
|
||||
|
||||
double devPixRatio;
|
||||
double aspectRatio;
|
||||
double aspectX;
|
||||
double aspectY;
|
||||
double xscale;
|
||||
double yscale;
|
||||
int view_width;
|
||||
|
@ -54,7 +60,7 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
|
|||
int rh;
|
||||
GLuint gltexture;
|
||||
bool linearFilter;
|
||||
bool sqrPixels;
|
||||
bool forceAspect;
|
||||
bool autoScaleEna;
|
||||
|
||||
unsigned int mouseButtonMask;
|
||||
|
|
|
@ -57,6 +57,10 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
yscale = 2.0;
|
||||
|
||||
devPixRatio = 1.0f;
|
||||
aspectRatio = 1.0f;
|
||||
aspectX = 1.0f;
|
||||
aspectY = 1.0f;
|
||||
|
||||
sdlWindow = NULL;
|
||||
sdlRenderer = NULL;
|
||||
sdlTexture = NULL;
|
||||
|
@ -73,7 +77,7 @@ ConsoleViewSDL_t::ConsoleViewSDL_t(QWidget *parent)
|
|||
memset( localBuf, 0, localBufSize );
|
||||
}
|
||||
|
||||
sqrPixels = true;
|
||||
forceAspect = true;
|
||||
autoScaleEna = true;
|
||||
linearFilter = false;
|
||||
|
||||
|
@ -118,7 +122,7 @@ void ConsoleViewSDL_t::setScaleXY( double xs, double ys )
|
|||
xscale = xs;
|
||||
yscale = ys;
|
||||
|
||||
if ( sqrPixels )
|
||||
if ( forceAspect )
|
||||
{
|
||||
if ( (xscale*xyRatio) < yscale )
|
||||
{
|
||||
|
@ -131,6 +135,25 @@ void ConsoleViewSDL_t::setScaleXY( double xs, double ys )
|
|||
}
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::setAspectXY( double x, double y )
|
||||
{
|
||||
aspectX = x;
|
||||
aspectY = y;
|
||||
|
||||
aspectRatio = aspectY / aspectX;
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::getAspectXY( double &x, double &y )
|
||||
{
|
||||
x = aspectX;
|
||||
y = aspectY;
|
||||
}
|
||||
|
||||
double ConsoleViewSDL_t::getAspectRatio(void)
|
||||
{
|
||||
return aspectRatio;
|
||||
}
|
||||
|
||||
void ConsoleViewSDL_t::transfer2LocalBuffer(void)
|
||||
{
|
||||
int i=0, hq = 0;
|
||||
|
@ -354,7 +377,7 @@ void ConsoleViewSDL_t::render(void)
|
|||
float xscaleTmp = (float)view_width / (float)nesWidth;
|
||||
float yscaleTmp = (float)view_height / (float)nesHeight;
|
||||
|
||||
if ( sqrPixels )
|
||||
if ( forceAspect )
|
||||
{
|
||||
if ( (xscaleTmp*xyRatio) < yscaleTmp )
|
||||
{
|
||||
|
@ -385,6 +408,42 @@ void ConsoleViewSDL_t::render(void)
|
|||
|
||||
rw=(int)(nesWidth*xscaleTmp);
|
||||
rh=(int)(nesHeight*yscaleTmp);
|
||||
|
||||
if ( forceAspect )
|
||||
{
|
||||
int iw, ih, ax, ay;
|
||||
|
||||
ax = (int)(aspectX+0.50);
|
||||
ay = (int)(aspectY+0.50);
|
||||
|
||||
iw = rw * ay;
|
||||
ih = rh * ax;
|
||||
|
||||
if ( iw > ih )
|
||||
{
|
||||
rh = (rw * ay) / ax;
|
||||
}
|
||||
else
|
||||
{
|
||||
rw = (rh * ax) / ay;
|
||||
}
|
||||
|
||||
if ( rw > view_width )
|
||||
{
|
||||
rw = view_width;
|
||||
rh = (rw * ay) / ax;
|
||||
}
|
||||
|
||||
if ( rh > view_height )
|
||||
{
|
||||
rh = view_height;
|
||||
rw = (rh * ax) / ay;
|
||||
}
|
||||
}
|
||||
|
||||
if ( rw > view_width ) rw = view_width;
|
||||
if ( rh > view_height) rh = view_height;
|
||||
|
||||
sx=(view_width-rw)/2;
|
||||
sy=(view_height-rh)/2;
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ class ConsoleViewSDL_t : public QWidget
|
|||
|
||||
void transfer2LocalBuffer(void);
|
||||
|
||||
void setLinearFilterEnable( bool ena );
|
||||
void setLinearFilterEnable( bool ena );
|
||||
|
||||
bool getSqrPixelOpt(void){ return sqrPixels; };
|
||||
void setSqrPixelOpt( bool val ){ sqrPixels = val; return; };
|
||||
bool getForceAspectOpt(void){ return forceAspect; };
|
||||
void setForceAspectOpt( bool val ){ forceAspect = val; return; };
|
||||
bool getAutoScaleOpt(void){ return autoScaleEna; };
|
||||
void setAutoScaleOpt( bool val ){ autoScaleEna = val; return; };
|
||||
double getScaleX(void){ return xscale; };
|
||||
|
@ -34,6 +34,9 @@ class ConsoleViewSDL_t : public QWidget
|
|||
void setScaleXY( double xs, double ys );
|
||||
void getNormalizedCursorPos( double &x, double &y );
|
||||
bool getMouseButtonState( unsigned int btn );
|
||||
void setAspectXY( double x, double y );
|
||||
void getAspectXY( double &x, double &y );
|
||||
double getAspectRatio(void);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -46,6 +49,9 @@ class ConsoleViewSDL_t : public QWidget
|
|||
int view_height;
|
||||
|
||||
double devPixRatio;
|
||||
double aspectRatio;
|
||||
double aspectX;
|
||||
double aspectY;
|
||||
double xscale;
|
||||
double yscale;
|
||||
int rw;
|
||||
|
@ -57,7 +63,7 @@ class ConsoleViewSDL_t : public QWidget
|
|||
|
||||
bool vsyncEnabled;
|
||||
bool linearFilter;
|
||||
bool sqrPixels;
|
||||
bool forceAspect;
|
||||
bool autoScaleEna;
|
||||
|
||||
uint32_t *localBuf;
|
||||
|
|
|
@ -118,6 +118,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
|
|||
|
||||
setCentralWidget(viewport_GL);
|
||||
}
|
||||
setViewportAspect();
|
||||
|
||||
setWindowTitle( tr(FCEU_NAME_AND_VERSION) );
|
||||
setWindowIcon(QIcon(":fceux1.png"));
|
||||
|
@ -273,13 +274,13 @@ QSize consoleWin_t::calcRequiredSize(void)
|
|||
QSize out( GL_NES_WIDTH, GL_NES_HEIGHT );
|
||||
|
||||
QSize w, v;
|
||||
double xscale, yscale;
|
||||
double xscale = 1.0, yscale = 1.0, aspectRatio = 1.0;
|
||||
int texture_width = GL_NES_WIDTH;
|
||||
int texture_height = GL_NES_HEIGHT;
|
||||
int l=0, r=texture_width;
|
||||
int t=0, b=texture_height;
|
||||
int dw=0, dh=0, rw, rh;
|
||||
bool sqrPixChkd = true;
|
||||
bool forceAspect = true;
|
||||
|
||||
CalcVideoDimensions();
|
||||
|
||||
|
@ -294,14 +295,16 @@ QSize consoleWin_t::calcRequiredSize(void)
|
|||
if ( viewport_GL )
|
||||
{
|
||||
v = viewport_GL->size();
|
||||
sqrPixChkd = viewport_GL->getSqrPixelOpt();
|
||||
forceAspect = viewport_GL->getForceAspectOpt();
|
||||
aspectRatio = viewport_GL->getAspectRatio();
|
||||
xscale = viewport_GL->getScaleX();
|
||||
yscale = viewport_GL->getScaleY();
|
||||
}
|
||||
else if ( viewport_SDL )
|
||||
{
|
||||
v = viewport_SDL->size();
|
||||
sqrPixChkd = viewport_SDL->getSqrPixelOpt();
|
||||
forceAspect = viewport_SDL->getForceAspectOpt();
|
||||
aspectRatio = viewport_SDL->getAspectRatio();
|
||||
xscale = viewport_SDL->getScaleX();
|
||||
yscale = viewport_SDL->getScaleY();
|
||||
}
|
||||
|
@ -309,7 +312,7 @@ QSize consoleWin_t::calcRequiredSize(void)
|
|||
dw = 0;
|
||||
dh = 0;
|
||||
|
||||
if ( sqrPixChkd )
|
||||
if ( forceAspect )
|
||||
{
|
||||
yscale = xscale * (double)nes_shm->video.xyRatio;
|
||||
}
|
||||
|
@ -318,6 +321,22 @@ QSize consoleWin_t::calcRequiredSize(void)
|
|||
|
||||
//printf("view %i x %i \n", rw, rh );
|
||||
|
||||
if ( forceAspect )
|
||||
{
|
||||
double rr;
|
||||
|
||||
rr = (double)rh / (double)rw;
|
||||
|
||||
if ( rr > aspectRatio )
|
||||
{
|
||||
rw = (int)( (((double)rh) / aspectRatio) + 0.50);
|
||||
}
|
||||
else
|
||||
{
|
||||
rh = (int)( (((double)rw) * aspectRatio) + 0.50);
|
||||
}
|
||||
}
|
||||
|
||||
out.setWidth( rw + dw );
|
||||
out.setHeight( rh + dh );
|
||||
|
||||
|
@ -326,6 +345,48 @@ QSize consoleWin_t::calcRequiredSize(void)
|
|||
return out;
|
||||
}
|
||||
|
||||
void consoleWin_t::setViewportAspect(void)
|
||||
{
|
||||
int aspectSel;
|
||||
double x,y;
|
||||
|
||||
g_config->getOption ("SDL.AspectSelect", &aspectSel);
|
||||
|
||||
switch ( aspectSel )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
x = 1.0; y = 1.0;
|
||||
break;
|
||||
case 1:
|
||||
x = 8.0; y = 7.0;
|
||||
break;
|
||||
case 2:
|
||||
x = 11.0; y = 8.0;
|
||||
break;
|
||||
case 3:
|
||||
x = 4.0; y = 3.0;
|
||||
break;
|
||||
case 4:
|
||||
x = 16.0; y = 9.0;
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
x = 1.0; y = 1.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( viewport_GL )
|
||||
{
|
||||
viewport_GL->setAspectXY( x, y );
|
||||
}
|
||||
else if ( viewport_SDL )
|
||||
{
|
||||
viewport_SDL->setAspectXY( x, y );
|
||||
}
|
||||
}
|
||||
|
||||
void consoleWin_t::loadCursor(void)
|
||||
{
|
||||
int cursorVis;
|
||||
|
@ -399,7 +460,7 @@ void consoleWin_t::setViewerCursor( Qt::CursorShape s )
|
|||
|
||||
Qt::CursorShape consoleWin_t::getViewerCursor(void)
|
||||
{
|
||||
Qt::CursorShape s;
|
||||
Qt::CursorShape s = Qt::ArrowCursor;
|
||||
|
||||
if ( viewport_GL )
|
||||
{
|
||||
|
@ -2811,14 +2872,10 @@ void consoleWin_t::syncActionConfig( QAction *act, const char *property )
|
|||
|
||||
void consoleWin_t::updatePeriodic(void)
|
||||
{
|
||||
//struct timespec ts;
|
||||
//double t;
|
||||
|
||||
//clock_gettime( CLOCK_REALTIME, &ts );
|
||||
|
||||
//t = (double)ts.tv_sec + (double)(ts.tv_nsec * 1.0e-9);
|
||||
//printf("Run Frame %f\n", t);
|
||||
|
||||
// Process all events before attempting to render viewport
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
// Update Input Devices
|
||||
FCEUD_UpdateInput();
|
||||
|
||||
|
@ -2835,7 +2892,6 @@ void consoleWin_t::updatePeriodic(void)
|
|||
else
|
||||
{
|
||||
viewport_GL->transfer2LocalBuffer();
|
||||
//viewport_GL->repaint();
|
||||
viewport_GL->update();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,8 @@ class consoleWin_t : public QMainWindow
|
|||
|
||||
QSize calcRequiredSize(void);
|
||||
|
||||
void setViewportAspect(void);
|
||||
|
||||
void loadCursor(void);
|
||||
void setViewerCursor( QCursor s );
|
||||
void setViewerCursor( Qt::CursorShape s );
|
||||
|
|
|
@ -727,9 +727,11 @@ static const char *getRoleText( QPalette::ColorRole role )
|
|||
case QPalette::ToolTipText:
|
||||
rTxt = "ToolTipText";
|
||||
break;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
|
||||
case QPalette::PlaceholderText:
|
||||
rTxt = "PlaceholderText";
|
||||
break;
|
||||
#endif
|
||||
case QPalette::Text:
|
||||
rTxt = "Text";
|
||||
break;
|
||||
|
|
|
@ -128,7 +128,9 @@ LuaControlDialog_t::LuaControlDialog_t(QWidget *parent)
|
|||
|
||||
g_config->getOption("SDL.LastLoadLua", &filename);
|
||||
|
||||
scriptPath->setText(filename.c_str());
|
||||
scriptPath->setText( tr(filename.c_str()) );
|
||||
scriptPath->setClearButtonEnabled(true);
|
||||
scriptArgs->setClearButtonEnabled(true);
|
||||
|
||||
luaOutput = new QTextEdit();
|
||||
luaOutput->setReadOnly(true);
|
||||
|
@ -401,7 +403,7 @@ void LuaControlDialog_t::openLuaScriptFile(void)
|
|||
|
||||
g_config->setOption("SDL.LastLoadLua", filename.toStdString().c_str());
|
||||
|
||||
scriptPath->setText(filename.toStdString().c_str());
|
||||
scriptPath->setText(filename);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -261,7 +261,10 @@ InitConfig()
|
|||
config->addOption("SDL.WinSizeY", 0);
|
||||
config->addOption("doublebuf", "SDL.DoubleBuffering", 1);
|
||||
config->addOption("autoscale", "SDL.AutoScale", 1);
|
||||
config->addOption("keepratio", "SDL.KeepRatio", 1);
|
||||
config->addOption("forceAspect", "SDL.ForceAspect", 1);
|
||||
config->addOption("aspectSelect", "SDL.AspectSelect", 0);
|
||||
config->addOption("aspectX", "SDL.AspectX", 1.000);
|
||||
config->addOption("aspectY", "SDL.AspectY", 1.000);
|
||||
config->addOption("xscale", "SDL.XScale", 2.000);
|
||||
config->addOption("yscale", "SDL.YScale", 2.000);
|
||||
config->addOption("xstretch", "SDL.XStretch", 0);
|
||||
|
|
|
@ -605,7 +605,7 @@ static void KeyboardCommands (void)
|
|||
}
|
||||
}
|
||||
|
||||
if (g_keyState[SDL_SCANCODE_LSHIFT] || g_keyState[SDL_SCANCODE_RSHIFT])
|
||||
if (g_keyState[SDL_SCANCODE_LSHIFT] || g_keyState[SDL_SCANCODE_RSHIFT])
|
||||
{
|
||||
is_shift = 1;
|
||||
}
|
||||
|
@ -626,14 +626,11 @@ static void KeyboardCommands (void)
|
|||
|
||||
if ( Hotkeys[HK_TOGGLE_BG].getRisingEdge() )
|
||||
{
|
||||
if (is_shift)
|
||||
{
|
||||
FCEUI_SetRenderPlanes (true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
FCEUI_SetRenderPlanes (true, true);
|
||||
}
|
||||
bool fgOn, bgOn;
|
||||
|
||||
FCEUI_GetRenderPlanes( fgOn, bgOn );
|
||||
|
||||
FCEUI_SetRenderPlanes( fgOn, !bgOn );
|
||||
}
|
||||
|
||||
// Alt-Enter to toggle full-screen
|
||||
|
|
Loading…
Reference in New Issue