mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-12 09:48:51 +01:00
reset variables correctly in menumode::end so that SDL initialize after a deinitialize does not trap
Signed-off-by: Vincent-FK <vincent.buso@funkey-project.com>
This commit is contained in:
parent
a72210beb3
commit
af54231219
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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( );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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_ )
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user