From af36932f3071d8081d057cc03bb568a8f46ad64a Mon Sep 17 00:00:00 2001
From: Aloshi <allofquist@yahoo.com>
Date: Tue, 18 Dec 2012 09:20:13 -0600
Subject: [PATCH] Added --no-exit switch. This switch will keep ES from
 displaying the "Exit" option in the menu.

---
 README.md                  | 13 ++++++++++++-
 src/components/GuiMenu.cpp |  7 ++++++-
 src/main.cpp               |  5 +++++
 3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 29c6e1fff..9c3d0c46b 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ EmulationStation will return once your system's command terminates (i.e. your em
 
 
 **Keyboard mappings:**
-
+```
 Up - Scroll up
 
 Down - Scroll down
@@ -71,9 +71,20 @@ F1 - Open the restart/shutdown system menu
 F2 - Open the fast select dialog
 
 F4 - Close EmulationStation (should work as long as ES hasn't frozen)
+```
 
 Unfortunately, there is no built-in way to change keyboard mappings - if you need to, check out `src/InputManager.cpp`. There's a switch statement with a list of keys; it should be pretty simple to change them.
 
+You can use `--help` to view a list of command-line options. Briefly outlined here:
+```
+-w [width]		- specify resolution width.
+-h [height]		- specify resolution height.
+--gamelist-only		- only display games defined in a gamelist.xml file.
+--ignore-gamelist	- do not parse any gamelist.xml files.
+--draw-framerate	- draw the framerate.
+--no-exit		- do not display 'exit' in the ES menu.
+```
+
 Writing an es_systems.cfg
 =========================
 The file `~/.emulationstation/es_systems.cfg` contains the system configuration data for EmulationStation. A system is a NAME, DESCNAME, PATH, EXTENSION, and COMMAND. You can define any number of systems. You can switch between them by pressing left and right. They will cycle in the order they are defined.
diff --git a/src/components/GuiMenu.cpp b/src/components/GuiMenu.cpp
index e99d30baf..640e7bc96 100644
--- a/src/components/GuiMenu.cpp
+++ b/src/components/GuiMenu.cpp
@@ -2,6 +2,9 @@
 #include <iostream>
 #include <SDL/SDL.h>
 
+//defined in main.cpp
+extern bool DONTSHOWEXIT;
+
 GuiMenu::GuiMenu(GuiComponent* parent)
 {
 	mParent = parent;
@@ -71,7 +74,9 @@ void GuiMenu::populateList()
 	//if you want to do something special within ES, override your command in the executeComand() method
 	mList->addObject("Restart", "sudo shutdown -r now", 0x0000FFFF);
 	mList->addObject("Shutdown", "sudo shutdown -h now", 0x0000FFFF);
-	mList->addObject("Exit", "exit", 0xFF0000FF); //a special case; pushes an SDL quit event to the event stack instead of being called by system()
+
+	if(!DONTSHOWEXIT)
+		mList->addObject("Exit", "exit", 0xFF0000FF); //a special case; pushes an SDL quit event to the event stack instead of being called by system()
 }
 
 void GuiMenu::onRender()
diff --git a/src/main.cpp b/src/main.cpp
index 1849d8a15..01484107e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -20,6 +20,7 @@
 bool PARSEGAMELISTONLY = false;
 bool IGNOREGAMELIST = false;
 bool DRAWFRAMERATE = false;
+bool DONTSHOWEXIT = false;
 
 namespace fs = boost::filesystem;
 
@@ -48,6 +49,9 @@ int main(int argc, char* argv[])
 			}else if(strcmp(argv[i], "--draw-framerate") == 0)
 			{
 				DRAWFRAMERATE = true;
+			}else if(strcmp(argv[i], "--no-exit") == 0)
+			{
+				DONTSHOWEXIT = true;
 			}else if(strcmp(argv[i], "--help") == 0)
 			{
 				std::cout << "EmulationStation, a graphical front-end for ROM browsing.\n";
@@ -57,6 +61,7 @@ int main(int argc, char* argv[])
 				std::cout << "--gamelist-only			skip automatic game detection, only read from gamelist.xml\n";
 				std::cout << "--ignore-gamelist		ignore the gamelist (useful for troubleshooting)\n";
 				std::cout << "--draw-framerate		display the framerate\n";
+				std::cout << "--no-exit			don't show the exit option in the menu\n";
 				std::cout << "--help				summon a sentient, angry tuba\n\n";
 				std::cout << "More information available in README.md.\n";
 				return 0;