Fix: ara apaga el sistem al final del tot, almenys quan ja ha escrit la configuració a disc
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user