diff --git a/source/director.cpp b/source/director.cpp index d633e64..f3f2498 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -126,6 +126,10 @@ void Director::close() SDL_DestroyWindow(window_); SDL_Quit(); + +#ifdef ARCADE + shutdownSystem(section::options == section::Options::QUIT_WITH_CONTROLLER); +#endif } // Carga los parametros @@ -762,11 +766,6 @@ int Director::run() // Habilita de nuevo los std::cout std::cout.rdbuf(orig_buf); #endif -#ifdef ARCADE - // Comprueba si ha de apagar el sistema - if (section::options == section::Options::QUIT_WITH_CONTROLLER) - shutdownSystem(); -#endif return (section::options == section::Options::QUIT_WITH_CONTROLLER) ? 1 : 0; } @@ -794,20 +793,23 @@ std::string Director::getLangFile(lang::Code code) #ifdef ARCADE // Apaga el sistema -void Director::shutdownSystem() +void Director::shutdownSystem(bool shouldShutdown) { + if (shouldShutdown) + { #ifdef _WIN32 - // Apaga el sistema en Windows - system("shutdown /s /t 0"); + // Apaga el sistema en Windows + system("shutdown /s /t 5"); #elif __APPLE__ - // Apaga el sistema en macOS - system("sudo shutdown -h now"); + // Apaga el sistema en macOS + system("sudo shutdown -h +0.1"); #elif __linux__ - // Apaga el sistema en Linux - system("shutdown -h now"); + // Apaga el sistema en Linux + system("shutdown -h +0.1"); #else // Sistema operativo no compatible #error "Sistema operativo no soportado" #endif + } } #endif // ARCADE diff --git a/source/director.h b/source/director.h index 9f73d4e..9913715 100644 --- a/source/director.h +++ b/source/director.h @@ -74,7 +74,7 @@ private: std::string getLangFile(lang::Code code); #ifdef ARCADE // Apaga el sistema - void shutdownSystem(); + void shutdownSystem(bool shouldShutdown); #endif // Inicializa todo