Added logic to further ensure that changes to emulation video settings force an settings change on the Qt console viewer.

This commit is contained in:
mjbudd77 2021-05-15 07:03:53 -04:00
parent 6fda3ca0b3
commit 31608a5c6d
9 changed files with 73 additions and 31 deletions

View File

@ -114,16 +114,23 @@ int ConsoleViewGL_t::init( void )
return 0;
}
void ConsoleViewGL_t::reset(void)
{
buildTextures();
return;
}
void ConsoleViewGL_t::buildTextures(void)
{
int w, h;
glEnable(GL_TEXTURE_RECTANGLE);
glEnable(GL_TEXTURE_RECTANGLE);
if ( gltexture )
{
glDeleteTextures(1, &gltexture);
gltexture=0;
}
if ( gltexture )
{
glDeleteTextures(1, &gltexture);
gltexture=0;
}
glGenTextures(1, &gltexture);
//printf("Linear Interpolation on GL Texture: %s \n", linearFilter ? "Enabled" : "Disabled");

View File

@ -16,7 +16,8 @@ class ConsoleViewGL_t : public QOpenGLWidget, protected QOpenGLFunctions
ConsoleViewGL_t(QWidget *parent = 0);
~ConsoleViewGL_t(void);
int init( void );
int init(void);
void reset(void);
void transfer2LocalBuffer(void);

View File

@ -194,14 +194,14 @@ int ConsoleViewSDL_t::init(void)
{
WId windowHandle;
if ( linearFilter )
{
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" );
}
else
{
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" );
}
if ( linearFilter )
{
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" );
}
else
{
SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "0" );
}
if (SDL_InitSubSystem(SDL_INIT_VIDEO) != 0)
{

View File

@ -14,7 +14,7 @@ class ConsoleViewSDL_t : public QWidget
public:
ConsoleViewSDL_t(QWidget *parent = 0);
~ConsoleViewSDL_t(void);
~ConsoleViewSDL_t(void);
int init(void);
void reset(void);

View File

@ -298,6 +298,34 @@ consoleWin_t::~consoleWin_t(void)
}
int consoleWin_t::videoInit(void)
{
int ret = 0;
if ( viewport_SDL )
{
ret = viewport_SDL->init();
}
else if ( viewport_GL )
{
ret = viewport_GL->init();
}
return ret;
}
void consoleWin_t::videoReset(void)
{
if ( viewport_SDL )
{
viewport_SDL->reset();
}
else if ( viewport_GL )
{
viewport_GL->reset();
}
return;
}
QSize consoleWin_t::calcRequiredSize(void)
{
QSize out( GL_NES_WIDTH, GL_NES_HEIGHT );

View File

@ -106,6 +106,8 @@ class consoleWin_t : public QMainWindow
QMutex *mutex;
#endif
int videoInit(void);
void videoReset(void);
void requestClose(void);
void QueueErrorMsgWindow( const char *msg );

View File

@ -356,17 +356,27 @@ int LoadGame(const char *path, bool silent)
FCEUI_SetRegion(region);
}
// Always re-calculate video dimensions after setting region.
CalcVideoDimensions();
// Force re-send of video settings to console viewer
if ( consoleWindow )
{
consoleWindow->videoReset();
}
g_config->getOption("SDL.SwapDuty", &id);
swapDuty = id;
std::string filename;
g_config->getOption("SDL.Sound.RecordFile", &filename);
if(filename.size()) {
if(!FCEUI_BeginWaveRecord(filename.c_str())) {
g_config->setOption("SDL.Sound.RecordFile", "");
}
}
// Wave Recording done through menu or hotkeys
//std::string filename;
//g_config->getOption("SDL.Sound.RecordFile", &filename);
//if (filename.size())
//{
// if (!FCEUI_BeginWaveRecord(filename.c_str())) {
// g_config->setOption("SDL.Sound.RecordFile", "");
// }
//}
isloaded = 1;
//FCEUD_NetworkConnect();

View File

@ -118,14 +118,7 @@ int main( int argc, char *argv[] )
consoleWindow->show();
if ( consoleWindow->viewport_SDL )
{
consoleWindow->viewport_SDL->init();
}
else
{
consoleWindow->viewport_GL->init();
}
consoleWindow->videoInit();
retval = app.exec();

View File

@ -240,6 +240,7 @@ int InitVideo(FCEUGI *gi)
switch ( s_sponge )
{
default:
case 0: // None
nes_shm->video.scale = 1;
break;