diff --git a/RetroFE/Source/Menu/MenuMode.cpp b/RetroFE/Source/Menu/MenuMode.cpp index c735b0e..968bdcf 100644 --- a/RetroFE/Source/Menu/MenuMode.cpp +++ b/RetroFE/Source/Menu/MenuMode.cpp @@ -111,10 +111,10 @@ void MenuMode::init( ) /// ------ Save prev key repeat params and set new Key repeat ------- - SDL_GetKeyRepeat(&backup_key_repeat_delay, &backup_key_repeat_interval); + /*SDL_GetKeyRepeat(&backup_key_repeat_delay, &backup_key_repeat_interval); if(SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL)){ MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError()); - } + }*/ /// ------ Init menu zones ------ init_menu_zones(); @@ -133,14 +133,21 @@ void MenuMode::end( ) /// ------ Free Surfaces ------- for(int i=0; i < nb_menu_zones; i++){ - SDL_FreeSurface(menu_zone_surfaces[i]); + if(menu_zone_surfaces[i] != NULL){ + SDL_FreeSurface(menu_zone_surfaces[i]); + } + } + idx_menus = NULL; + nb_menu_zones = 0; + + if(backup_hw_screen != NULL){ + SDL_FreeSurface(backup_hw_screen); } - SDL_FreeSurface(backup_hw_screen); /// ------ reset initial key repeat values ------ - if(SDL_EnableKeyRepeat(backup_key_repeat_delay, backup_key_repeat_interval)){ + /*if(SDL_EnableKeyRepeat(backup_key_repeat_delay, backup_key_repeat_interval)){ MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError()); - } + }*/ return; } diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp index 8f6c23f..efb8a52 100644 --- a/RetroFE/Source/RetroFE.cpp +++ b/RetroFE/Source/RetroFE.cpp @@ -223,6 +223,8 @@ void RetroFE::freeGraphicsMemory( ) if ( unloadSDL ) { currentPage_->deInitializeFonts( ); + // Deinit menuMode + MenuMode::end( ); SDL::deInitialize( ); //input_.clearJoysticks( ); } @@ -241,6 +243,7 @@ void RetroFE::allocateGraphicsMemory( ) { SDL::initialize( config_ ); currentPage_->initializeFonts( ); + // Init MenuMode MenuMode::init( ); } @@ -251,7 +254,6 @@ void RetroFE::allocateGraphicsMemory( ) currentPage_->allocateGraphicsMemory( ); } - } @@ -261,9 +263,6 @@ bool RetroFE::deInitialize( ) bool retVal = true; - // Deinit menuMode - MenuMode::end( ); - // Free textures freeGraphicsMemory( ); @@ -849,16 +848,10 @@ void RetroFE::run( ) launchEnter( ); l.run(nextPageItem_->collectionInfo->name, nextPageItem_); -/********************************/ -#warning to remove - //bypass - state = RETROFE_QUIT_REQUEST; - break; -/********************************/ - launchExit( ); currentPage_->exitGame( ); - state = RETROFE_QUIT_REQUEST; + + state = RETROFE_LAUNCH_EXIT; } break; @@ -866,6 +859,12 @@ void RetroFE::run( ) case RETROFE_LAUNCH_EXIT: if ( currentPage_->isIdle( ) ) { + /********************************/ + /*#warning to remove + //bypass + state = RETROFE_QUIT_REQUEST; + break;*/ + /********************************/ state = RETROFE_IDLE; } break; @@ -1071,7 +1070,9 @@ void RetroFE::run( ) currentPage_->update( deltaTime ); } - render( ); + if(!currentPage_->isIdle( ) || splashMode){ + render( ); + } } } } diff --git a/RetroFE/Source/SDL.cpp b/RetroFE/Source/SDL.cpp index e5bbf76..89e8701 100644 --- a/RetroFE/Source/SDL.cpp +++ b/RetroFE/Source/SDL.cpp @@ -234,11 +234,11 @@ bool SDL::initialize( Configuration &config ) } } - if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 ) + /*if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 ) { std::string error = Mix_GetError( ); Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error ); - } + }*/ return retVal; @@ -251,8 +251,8 @@ bool SDL::deInitialize( ) std::string error = SDL_GetError( ); Logger::write( Logger::ZONE_INFO, "SDL", "DeInitializing" ); - Mix_CloseAudio( ); - Mix_Quit( ); + /*Mix_CloseAudio( ); + Mix_Quit( );*/ if ( mutex_ ) {