diff --git a/src/drivers/Qt/ConsoleViewerGL.cpp b/src/drivers/Qt/ConsoleViewerGL.cpp index d5590d44..4fb5466c 100644 --- a/src/drivers/Qt/ConsoleViewerGL.cpp +++ b/src/drivers/Qt/ConsoleViewerGL.cpp @@ -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"); diff --git a/src/drivers/Qt/ConsoleViewerGL.h b/src/drivers/Qt/ConsoleViewerGL.h index dfdff004..456b2b60 100644 --- a/src/drivers/Qt/ConsoleViewerGL.h +++ b/src/drivers/Qt/ConsoleViewerGL.h @@ -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); diff --git a/src/drivers/Qt/ConsoleViewerSDL.cpp b/src/drivers/Qt/ConsoleViewerSDL.cpp index e00a36f8..a544e0b2 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.cpp +++ b/src/drivers/Qt/ConsoleViewerSDL.cpp @@ -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) { diff --git a/src/drivers/Qt/ConsoleViewerSDL.h b/src/drivers/Qt/ConsoleViewerSDL.h index 809661f4..f536acf2 100644 --- a/src/drivers/Qt/ConsoleViewerSDL.h +++ b/src/drivers/Qt/ConsoleViewerSDL.h @@ -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); diff --git a/src/drivers/Qt/ConsoleWindow.cpp b/src/drivers/Qt/ConsoleWindow.cpp index cef5b1fd..6a16cea7 100644 --- a/src/drivers/Qt/ConsoleWindow.cpp +++ b/src/drivers/Qt/ConsoleWindow.cpp @@ -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 ); diff --git a/src/drivers/Qt/ConsoleWindow.h b/src/drivers/Qt/ConsoleWindow.h index f2ff4c61..89243d18 100644 --- a/src/drivers/Qt/ConsoleWindow.h +++ b/src/drivers/Qt/ConsoleWindow.h @@ -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 ); diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index f445c837..4fc89ed5 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -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(); diff --git a/src/drivers/Qt/main.cpp b/src/drivers/Qt/main.cpp index 468ab2ed..31558c55 100644 --- a/src/drivers/Qt/main.cpp +++ b/src/drivers/Qt/main.cpp @@ -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(); diff --git a/src/drivers/Qt/sdl-video.cpp b/src/drivers/Qt/sdl-video.cpp index f574c6a3..b62bbc11 100644 --- a/src/drivers/Qt/sdl-video.cpp +++ b/src/drivers/Qt/sdl-video.cpp @@ -240,6 +240,7 @@ int InitVideo(FCEUGI *gi) switch ( s_sponge ) { + default: case 0: // None nes_shm->video.scale = 1; break;