mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 10:18:53 +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 -------
|
/// ------ 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)){
|
if(SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL)){
|
||||||
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/// ------ Init menu zones ------
|
/// ------ Init menu zones ------
|
||||||
init_menu_zones();
|
init_menu_zones();
|
||||||
@ -133,14 +133,21 @@ void MenuMode::end( )
|
|||||||
|
|
||||||
/// ------ Free Surfaces -------
|
/// ------ Free Surfaces -------
|
||||||
for(int i=0; i < nb_menu_zones; i++){
|
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 ------
|
/// ------ 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());
|
MENU_ERROR_PRINTF("ERROR with SDL_EnableKeyRepeat: %s\n", SDL_GetError());
|
||||||
}
|
}*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -223,6 +223,8 @@ void RetroFE::freeGraphicsMemory( )
|
|||||||
if ( unloadSDL )
|
if ( unloadSDL )
|
||||||
{
|
{
|
||||||
currentPage_->deInitializeFonts( );
|
currentPage_->deInitializeFonts( );
|
||||||
|
// Deinit menuMode
|
||||||
|
MenuMode::end( );
|
||||||
SDL::deInitialize( );
|
SDL::deInitialize( );
|
||||||
//input_.clearJoysticks( );
|
//input_.clearJoysticks( );
|
||||||
}
|
}
|
||||||
@ -241,6 +243,7 @@ void RetroFE::allocateGraphicsMemory( )
|
|||||||
{
|
{
|
||||||
SDL::initialize( config_ );
|
SDL::initialize( config_ );
|
||||||
currentPage_->initializeFonts( );
|
currentPage_->initializeFonts( );
|
||||||
|
|
||||||
// Init MenuMode
|
// Init MenuMode
|
||||||
MenuMode::init( );
|
MenuMode::init( );
|
||||||
}
|
}
|
||||||
@ -251,7 +254,6 @@ void RetroFE::allocateGraphicsMemory( )
|
|||||||
currentPage_->allocateGraphicsMemory( );
|
currentPage_->allocateGraphicsMemory( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -261,9 +263,6 @@ bool RetroFE::deInitialize( )
|
|||||||
|
|
||||||
bool retVal = true;
|
bool retVal = true;
|
||||||
|
|
||||||
// Deinit menuMode
|
|
||||||
MenuMode::end( );
|
|
||||||
|
|
||||||
// Free textures
|
// Free textures
|
||||||
freeGraphicsMemory( );
|
freeGraphicsMemory( );
|
||||||
|
|
||||||
@ -849,16 +848,10 @@ void RetroFE::run( )
|
|||||||
launchEnter( );
|
launchEnter( );
|
||||||
l.run(nextPageItem_->collectionInfo->name, nextPageItem_);
|
l.run(nextPageItem_->collectionInfo->name, nextPageItem_);
|
||||||
|
|
||||||
/********************************/
|
|
||||||
#warning to remove
|
|
||||||
//bypass
|
|
||||||
state = RETROFE_QUIT_REQUEST;
|
|
||||||
break;
|
|
||||||
/********************************/
|
|
||||||
|
|
||||||
launchExit( );
|
launchExit( );
|
||||||
currentPage_->exitGame( );
|
currentPage_->exitGame( );
|
||||||
state = RETROFE_QUIT_REQUEST;
|
|
||||||
|
state = RETROFE_LAUNCH_EXIT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -866,6 +859,12 @@ void RetroFE::run( )
|
|||||||
case RETROFE_LAUNCH_EXIT:
|
case RETROFE_LAUNCH_EXIT:
|
||||||
if ( currentPage_->isIdle( ) )
|
if ( currentPage_->isIdle( ) )
|
||||||
{
|
{
|
||||||
|
/********************************/
|
||||||
|
/*#warning to remove
|
||||||
|
//bypass
|
||||||
|
state = RETROFE_QUIT_REQUEST;
|
||||||
|
break;*/
|
||||||
|
/********************************/
|
||||||
state = RETROFE_IDLE;
|
state = RETROFE_IDLE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1071,7 +1070,9 @@ void RetroFE::run( )
|
|||||||
currentPage_->update( deltaTime );
|
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( );
|
std::string error = Mix_GetError( );
|
||||||
Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error );
|
Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error );
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
|
|
||||||
@ -251,8 +251,8 @@ bool SDL::deInitialize( )
|
|||||||
std::string error = SDL_GetError( );
|
std::string error = SDL_GetError( );
|
||||||
Logger::write( Logger::ZONE_INFO, "SDL", "DeInitializing" );
|
Logger::write( Logger::ZONE_INFO, "SDL", "DeInitializing" );
|
||||||
|
|
||||||
Mix_CloseAudio( );
|
/*Mix_CloseAudio( );
|
||||||
Mix_Quit( );
|
Mix_Quit( );*/
|
||||||
|
|
||||||
if ( mutex_ )
|
if ( mutex_ )
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user