Index: common/config-manager.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/config-manager.cpp,v
retrieving revision 1.17
diff -u -3 -p -r1.17 config-manager.cpp
--- common/config-manager.cpp	7 Feb 2004 04:53:59 -0000	1.17
+++ common/config-manager.cpp	12 Feb 2004 18:57:16 -0000
@@ -123,14 +123,19 @@ void ConfigManager::loadFile(const Strin
 			if (t[0] && t[0] != '#') {
 				if (t[0] == '[') {
 					// It's a new domain which begins here.
-					char *p = strchr(t, ']');
-					if (!p) {
+					char *p = t + 1;
+					while (*p && (isalnum(*p) || *p=='-' || *p=='_'))
+					p++;
+
+					switch (*p) {
+					case '\0':
 						error("Config file buggy: no ] at the end of the domain name.\n");
-					} else {
+					case ']':
 						*p = 0;
-						// TODO: Some kind of domain name verification might be nice.
-						// E.g. restrict to only a-zA-Z0-9 and maybe -_  or so...
 						domain = t + 1;
+						break;
+					default:
+						error("Config file buggy: %c is not a valid character of a domain name.\n", *p);
 					}
 				} else {
 					// Skip leading whitespaces
@@ -293,9 +298,12 @@ const String & ConfigManager::get(const 
 
 int ConfigManager::getInt(const String &key, const String &dom) const {
 	String value(get(key, dom));
-	// Convert the string to an integer.
-	// TODO: We should perform some error checking.
-	return (int)strtol(value.c_str(), 0, 10);
+	char *errpos;
+	int ivalue = (int)strtol(value.c_str(), &errpos, 10);
+	if (value.c_str()==errpos)
+		error("Config file buggy: %s is not a valid integer.\n", errpos);
+
+	return ivalue;
 }
 
 bool ConfigManager::getBool(const String &key, const String &dom) const {
Index: gui/ListWidget.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.cpp,v
retrieving revision 1.35
diff -u -3 -p -r1.35 ListWidget.cpp
--- gui/ListWidget.cpp	5 Feb 2004 00:19:54 -0000	1.35
+++ gui/ListWidget.cpp	12 Feb 2004 18:57:17 -0000
@@ -51,6 +51,27 @@ ListWidget::ListWidget(GuiObject *boss, 
 ListWidget::~ListWidget() {
 }
 
+void ListWidget::setSelected(int item) {
+	assert( item>=-1 && item<(int)_list.size() );
+
+	if(isEnabled()) {
+		int oldSelectedItem = _selectedItem;
+		_selectedItem = item;
+
+		if (oldSelectedItem != _selectedItem) {
+			if (_editMode) {
+				// undo any changes made
+				_list[oldSelectedItem] = _backupString;
+				_editMode = false;
+				drawCaret(true);
+			}
+			sendCommand(kListSelectionChangedCmd, _selectedItem);
+		}
+		scrollToCurrent();
+		draw();
+	}
+}
+
 void ListWidget::setList(const StringList &list) {
 	if (_editMode && _caretVisible)
 		drawCaret(true);
Index: gui/ListWidget.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/ListWidget.h,v
retrieving revision 1.21
diff -u -3 -p -r1.21 ListWidget.h
--- gui/ListWidget.h	5 Feb 2004 00:19:54 -0000	1.21
+++ gui/ListWidget.h	12 Feb 2004 18:57:17 -0000
@@ -65,6 +65,7 @@ public:
 	void setList(const StringList& list);
 	const StringList& getList()	const			{ return _list; }
 	int getSelected() const						{ return _selectedItem; }
+	void setSelected(int item);
 	const String& getSelectedString() const		{ return _list[_selectedItem]; }
 	void setNumberingMode(NumberingMode numberingMode)	{ _numberingMode = numberingMode; }
 	bool isEditable() const						{ return _editable; }
Index: gui/launcher.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.cpp,v
retrieving revision 1.88
diff -u -3 -p -r1.88 launcher.cpp
--- gui/launcher.cpp	9 Feb 2004 07:52:21 -0000	1.88
+++ gui/launcher.cpp	12 Feb 2004 18:57:17 -0000
@@ -339,9 +341,19 @@ LauncherDialog::LauncherDialog(GameDetec
 	// Populate the list
 	updateListing();
 
-	// TODO - make a default selection (maybe the game user played last?)
-	//_list->setSelected(0);
-
+	// Restore last selection
+	String last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
+	if (!last.isEmpty()) {
+		int itemToSelect = 0;
+		StringList::const_iterator iter;
+		for (iter = _domains.begin(); iter != _domains.end(); ++iter, ++itemToSelect) {
+			if (last == *iter) {
+				_list->setSelected(itemToSelect);
+				break;
+			}
+		}
+	}
+	
 	// En-/Disable the buttons depending on the list selection
 	updateButtons();
 
@@ -353,6 +365,17 @@ LauncherDialog::~LauncherDialog() {
 	delete _browser;
 }
 
+void LauncherDialog::close() {
+	// Save last selection
+	if (_list->getSelected() >=0)
+		ConfMan.set(String("lastselectedgame"), _domains[_list->getSelected()], ConfigManager::kApplicationDomain);	
+	else
+		ConfMan.removeKey(String("lastselectedgame"), ConfigManager::kApplicationDomain);
+ 
+	ConfMan.flushToDisk();	
+	Dialog::close();
+}
+
 void LauncherDialog::updateListing() {
 	Common::StringList l;
 
@@ -569,9 +592,7 @@ void LauncherDialog::handleCommand(Comma
 		updateButtons();
 		break;
 	case kQuitCmd:
-#ifdef __PALM_OS__
 		close();
-#endif
 		g_system->quit();
 		break;
 	default:
Index: gui/launcher.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/launcher.h,v
retrieving revision 1.18
diff -u -3 -p -r1.18 launcher.h
--- gui/launcher.h	5 Feb 2004 11:59:04 -0000	1.18
+++ gui/launcher.h	12 Feb 2004 18:57:17 -0000
@@ -45,6 +45,8 @@ protected:
 	Widget			*_startButton;
 	Widget			*_editButton;
 	Widget			*_removeButton;
+	Widget			*_moveUpButton;
+	Widget			*_moveDownButton;
 	StringList		_domains;
 	GameDetector 	&_detector;
 	BrowserDialog	*_browser;
@@ -52,6 +54,7 @@ protected:
 	void updateListing();
 	void updateButtons();
 	
+	void close();
 	virtual void addGame();
 	void removeGame(int item);
 	void editGame(int item);
