diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 73bba31a2..c9d86dd64 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -238,7 +238,7 @@ void GuiMenu::openUISettings() screenmode.push_back("borderless"); for(auto it = screenmode.cbegin(); it != screenmode.cend(); it++) fullscreen_mode->add(*it, *it, Settings::getInstance()->getString("FullscreenMode") == *it); - s->addWithLabel("FULLSCREEN MODE (RESTART REQUIRED)", fullscreen_mode); + s->addWithLabel("FULLSCREEN MODE (REQUIRES RESTART)", fullscreen_mode); s->addSaveFunc([fullscreen_mode] { if (Settings::getInstance()->getString("FullscreenMode") == "normal" && fullscreen_mode->getSelected() != "normal") @@ -390,17 +390,17 @@ void GuiMenu::openUISettings() s->addWithLabel("DISABLE START MENU IN KID MODE", disable_start); s->addSaveFunc([disable_start] { Settings::getInstance()->setBool("DisableKidStartMenu", disable_start->getState()); }); - // hide Restart System option in the Quit menu - auto show_restartsystem = std::make_shared(mWindow); - show_restartsystem->setState(Settings::getInstance()->getBool("ShowRestartSystem")); - s->addWithLabel("SHOW \"RESTART SYSTEM\" MENU ENTRY", show_restartsystem); - s->addSaveFunc([show_restartsystem] { Settings::getInstance()->setBool("ShowRestartSystem", show_restartsystem->getState()); }); + // hide Reboot System option in the Quit menu + auto show_rebootsystem = std::make_shared(mWindow); + show_rebootsystem->setState(Settings::getInstance()->getBool("ShowRebootSystem")); + s->addWithLabel("SHOW \"REBOOT SYSTEM\" MENU ENTRY", show_rebootsystem); + s->addSaveFunc([show_rebootsystem] { Settings::getInstance()->setBool("ShowRebootSystem", show_rebootsystem->getState()); }); - // hide Shutdown System option in the Quit menu - auto show_shutdownsystem = std::make_shared(mWindow); - show_shutdownsystem->setState(Settings::getInstance()->getBool("ShowShutdownSystem")); - s->addWithLabel("SHOW \"SHUTDOWN SYSTEM\" MENU ENTRY", show_shutdownsystem); - s->addSaveFunc([show_shutdownsystem] { Settings::getInstance()->setBool("ShowShutdownSystem", show_shutdownsystem->getState()); }); + // hide Power Off System option in the Quit menu + auto show_poweroffsystem = std::make_shared(mWindow); + show_poweroffsystem->setState(Settings::getInstance()->getBool("ShowPoweroffSystem")); + s->addWithLabel("SHOW \"POWER OFF SYSTEM\" MENU ENTRY", show_poweroffsystem); + s->addSaveFunc([show_poweroffsystem] { Settings::getInstance()->setBool("ShowPoweroffSystem", show_poweroffsystem->getState()); }); // Show favorites first in gamelists auto favoritesFirstSwitch = std::make_shared(mWindow); @@ -527,23 +527,8 @@ void GuiMenu::openQuitMenu() ComponentListRow row; if (UIModeController::getInstance()->isUIModeFull()) { - - row.makeAcceptInputHandler([window] { - window->pushGui(new GuiMsgBox(window, "REALLY RESTART?", "YES", - [] { - Scripting::fireEvent("quit"); - if(quitES(QuitMode::RESTART) != 0) - LOG(LogWarning) << "Restart terminated with non-zero result!"; - }, "NO", nullptr)); - }); - row.addElement(std::make_shared(window, "RESTART EMULATIONSTATION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); - s->addRow(row); - - - if(Settings::getInstance()->getBool("ShowExit")) { - row.elements.clear(); row.makeAcceptInputHandler([window] { window->pushGui(new GuiMsgBox(window, "REALLY QUIT?", "YES", [] { @@ -556,35 +541,35 @@ void GuiMenu::openQuitMenu() } } - if(Settings::getInstance()->getBool("ShowRestartSystem")) + if(Settings::getInstance()->getBool("ShowRebootSystem")) { row.elements.clear(); row.makeAcceptInputHandler([window] { - window->pushGui(new GuiMsgBox(window, "REALLY RESTART?", "YES", + window->pushGui(new GuiMsgBox(window, "REALLY REBOOT?", "YES", [] { Scripting::fireEvent("quit", "reboot"); Scripting::fireEvent("reboot"); if (quitES(QuitMode::REBOOT) != 0) - LOG(LogWarning) << "Restart terminated with non-zero result!"; + LOG(LogWarning) << "Reboot terminated with non-zero result!"; }, "NO", nullptr)); }); - row.addElement(std::make_shared(window, "RESTART SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + row.addElement(std::make_shared(window, "REBOOT SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); s->addRow(row); } - if(Settings::getInstance()->getBool("ShowShutdownSystem")) + if(Settings::getInstance()->getBool("ShowPoweroffSystem")) { row.elements.clear(); row.makeAcceptInputHandler([window] { - window->pushGui(new GuiMsgBox(window, "REALLY SHUTDOWN?", "YES", + window->pushGui(new GuiMsgBox(window, "REALLY POWER OFF?", "YES", [] { - Scripting::fireEvent("quit", "shutdown"); - Scripting::fireEvent("shutdown"); - if (quitES(QuitMode::SHUTDOWN) != 0) - LOG(LogWarning) << "Shutdown terminated with non-zero result!"; + Scripting::fireEvent("quit", "poweroff"); + Scripting::fireEvent("poweroff"); + if (quitES(QuitMode::POWEROFF) != 0) + LOG(LogWarning) << "Poweroff terminated with non-zero result!"; }, "NO", nullptr)); }); - row.addElement(std::make_shared(window, "SHUTDOWN SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); + row.addElement(std::make_shared(window, "POWER OFF SYSTEM", Font::get(FONT_SIZE_MEDIUM), 0x777777FF), true); s->addRow(row); } diff --git a/es-core/src/Settings.cpp b/es-core/src/Settings.cpp index 400dd686c..1eebc2e5d 100644 --- a/es-core/src/Settings.cpp +++ b/es-core/src/Settings.cpp @@ -60,8 +60,8 @@ void Settings::setDefaults() mBoolMap["ShowHiddenFiles"] = false; mBoolMap["DrawFramerate"] = false; mBoolMap["ShowExit"] = true; - mBoolMap["ShowRestartSystem"] = true; - mBoolMap["ShowShutdownSystem"] = true; + mBoolMap["ShowRebootSystem"] = true; + mBoolMap["ShowPoweroffSystem"] = true; mBoolMap["Windowed"] = false; mBoolMap["SplashScreen"] = true; mBoolMap["SplashScreenProgress"] = true; diff --git a/es-core/src/platform.cpp b/es-core/src/platform.cpp index 81262310b..5402ae642 100644 --- a/es-core/src/platform.cpp +++ b/es-core/src/platform.cpp @@ -10,21 +10,21 @@ #include "Log.h" -int runShutdownCommand() -{ -#ifdef WIN32 // windows - return system("shutdown -s -t 0"); -#else // osx / linux - return system("sudo shutdown -h now"); -#endif -} - -int runRestartCommand() +int runRebootCommand() { #ifdef WIN32 // windows return system("shutdown -r -t 0"); #else // osx / linux - return system("sudo shutdown -r now"); + return system("shutdown --reboot now"); +#endif +} + +int runPoweroffCommand() +{ +#ifdef WIN32 // windows + return system("shutdown -s -t 0"); +#else // osx / linux + return system("shutdown --poweroff now"); #endif } @@ -71,19 +71,13 @@ void processQuitMode() { switch (quitMode) { - case QuitMode::RESTART: - LOG(LogInfo) << "Restarting EmulationStation"; - touch("/tmp/es-restart"); - break; case QuitMode::REBOOT: LOG(LogInfo) << "Rebooting system"; - touch("/tmp/es-sysrestart"); - runRestartCommand(); + runRebootCommand(); break; - case QuitMode::SHUTDOWN: - LOG(LogInfo) << "Shutting system down"; - touch("/tmp/es-shutdown"); - runShutdownCommand(); + case QuitMode::POWEROFF: + LOG(LogInfo) << "Powering off system"; + runPoweroffCommand(); break; } } diff --git a/es-core/src/platform.h b/es-core/src/platform.h index 1df4d56c6..8356e0d88 100644 --- a/es-core/src/platform.h +++ b/es-core/src/platform.h @@ -12,9 +12,8 @@ enum QuitMode { QUIT = 0, - RESTART = 1, - SHUTDOWN = 2, - REBOOT = 3 + REBOOT = 1, + POWEROFF = 2 }; int runSystemCommand(const std::string& cmd_utf8); // run a utf-8 encoded in the shell (requires wstring conversion on Windows) diff --git a/es-core/src/renderers/Renderer_GL21.cpp b/es-core/src/renderers/Renderer_GL21.cpp index d5c7025e7..ee3b91014 100644 --- a/es-core/src/renderers/Renderer_GL21.cpp +++ b/es-core/src/renderers/Renderer_GL21.cpp @@ -106,7 +106,7 @@ namespace Renderer LOG(LogInfo) << "GL version: " << version; LOG(LogInfo) << "Checking available OpenGL extensions..."; std::string glExts = glGetString(GL_EXTENSIONS) ? (const char*)glGetString(GL_EXTENSIONS) : ""; - LOG(LogInfo) << " ARB_texture_non_power_of_two: " << (extensions.find("ARB_texture_non_power_of_two") != std::string::npos ? "ok" : "MISSING"); + LOG(LogInfo) << "ARB_texture_non_power_of_two: " << (extensions.find("ARB_texture_non_power_of_two") != std::string::npos ? "ok" : "MISSING"); uint8_t data[4] = {255, 255, 255, 255}; whiteTexture = createTexture(Texture::RGBA, false, true, 1, 1, data); diff --git a/es-core/src/renderers/Renderer_GLES10.cpp b/es-core/src/renderers/Renderer_GLES10.cpp index 5c7ad692d..e733cf466 100644 --- a/es-core/src/renderers/Renderer_GLES10.cpp +++ b/es-core/src/renderers/Renderer_GLES10.cpp @@ -106,7 +106,7 @@ namespace Renderer LOG(LogInfo) << "GL version: " << version; LOG(LogInfo) << "Checking available OpenGL extensions..."; std::string glExts = glGetString(GL_EXTENSIONS) ? (const char*)glGetString(GL_EXTENSIONS) : ""; - LOG(LogInfo) << " ARB_texture_non_power_of_two: " << (extensions.find("ARB_texture_non_power_of_two") != std::string::npos ? "ok" : "MISSING"); + LOG(LogInfo) << "ARB_texture_non_power_of_two: " << (extensions.find("ARB_texture_non_power_of_two") != std::string::npos ? "ok" : "MISSING"); uint8_t data[4] = {255, 255, 255, 255}; whiteTexture = createTexture(Texture::RGBA, false, true, 1, 1, data);