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_DestroyWindow(window_);
|
||||||
|
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
|
||||||
|
#ifdef ARCADE
|
||||||
|
shutdownSystem(section::options == section::Options::QUIT_WITH_CONTROLLER);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Carga los parametros
|
// Carga los parametros
|
||||||
@@ -762,11 +766,6 @@ int Director::run()
|
|||||||
// Habilita de nuevo los std::cout
|
// Habilita de nuevo los std::cout
|
||||||
std::cout.rdbuf(orig_buf);
|
std::cout.rdbuf(orig_buf);
|
||||||
#endif
|
#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;
|
return (section::options == section::Options::QUIT_WITH_CONTROLLER) ? 1 : 0;
|
||||||
}
|
}
|
||||||
@@ -794,20 +793,23 @@ std::string Director::getLangFile(lang::Code code)
|
|||||||
|
|
||||||
#ifdef ARCADE
|
#ifdef ARCADE
|
||||||
// Apaga el sistema
|
// Apaga el sistema
|
||||||
void Director::shutdownSystem()
|
void Director::shutdownSystem(bool shouldShutdown)
|
||||||
{
|
{
|
||||||
|
if (shouldShutdown)
|
||||||
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Apaga el sistema en Windows
|
// Apaga el sistema en Windows
|
||||||
system("shutdown /s /t 0");
|
system("shutdown /s /t 5");
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
// Apaga el sistema en macOS
|
// Apaga el sistema en macOS
|
||||||
system("sudo shutdown -h now");
|
system("sudo shutdown -h +0.1");
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
// Apaga el sistema en Linux
|
// Apaga el sistema en Linux
|
||||||
system("shutdown -h now");
|
system("shutdown -h +0.1");
|
||||||
#else
|
#else
|
||||||
// Sistema operativo no compatible
|
// Sistema operativo no compatible
|
||||||
#error "Sistema operativo no soportado"
|
#error "Sistema operativo no soportado"
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif // ARCADE
|
#endif // ARCADE
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ private:
|
|||||||
std::string getLangFile(lang::Code code);
|
std::string getLangFile(lang::Code code);
|
||||||
#ifdef ARCADE
|
#ifdef ARCADE
|
||||||
// Apaga el sistema
|
// Apaga el sistema
|
||||||
void shutdownSystem();
|
void shutdownSystem(bool shouldShutdown);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Inicializa todo
|
// Inicializa todo
|
||||||
|
|||||||
Reference in New Issue
Block a user