Subversion Repositories spk

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
// PluginManager.cpp : main project file.
2
 
3
#include "stdafx.h"
4
#include "Forms\MainGui.h"
5
#include "Forms\StartUp.h"
6
#include "Languages.h"
7
 
8
using namespace PluginManager;
9
using namespace Microsoft::Win32;
10
using namespace System::IO;
11
 
12
#include <spk.h>
13
#undef GetTempPath
14
#undef GetCurrentDirectory
15
 
16
CPackages	packages;
17
CLanguages	Language;
18
 
19
 
20
 
21
[STAThreadAttribute]
22
int main(array<System::String ^> ^args)
23
{
24
	// Enabling Windows XP visual effects before any controls are created
25
	Application::EnableVisualStyles();
26
	Application::SetCompatibleTextRenderingDefault(false); 
27
 
28
	System::String ^tempDir = System::IO::Path::GetTempPath();
29
	System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
30
	System::String ^progfile = Environment::GetFolderPath(Environment::SpecialFolder::ProgramFiles );
31
 
32
	CyStringList dirList;
33
	CyStringList remDirList;
34
	System::String ^gameArgs;
35
	System::String ^openPackage;
36
 
37
	Language.SetLanguage(44);
38
 
39
	bool Advanced = false, fromLauncher = false, silent = false;
40
	for ( int i = 0; i < args->Length; i++ )
41
	{
42
		CyString arg = CyStringFromSystemString(args[i]);
43
 
44
		// its a switch
45
		if ( arg.Left(2) == "--" )
46
		{
47
			CyString argSwitch = arg.GetToken(":", 1, 1).ToLower();
48
			CyString rest = arg.GetToken(":", 2);
49
			if ( rest[0] == '"' && rest[rest.Length() - 1] != '"' )
50
			{
51
				rest.Erase(0, 1);
52
				while ( i < args->Length )
53
				{
54
					i++;
55
					CyString argCheck = CyStringFromSystemString(args[i]);
56
					rest += " ";
57
					rest += argCheck;
58
					if ( argCheck.Right(1) == "\"" )
59
						break;
60
				}
61
			}
62
 
63
			if ( rest.Right(1) == "\"" )
64
				rest.Truncate(rest.Length() - 1);
65
 
66
			if ( argSwitch == "--dir" && !rest.Empty() )
67
			{
68
				CyString gameName = packages.GetGameName(rest);
69
				if ( !gameName.Empty() )
70
					dirList.PushBack(rest, gameName);
71
			}
72
 
73
			if ( argSwitch == "--advanced" )
74
				Advanced = true;
75
			else if ( argSwitch == "--fromlauncher" )
76
				fromLauncher = true;
77
			else if ( argSwitch == "--silent" )
78
				silent = true;
79
			else if ( argSwitch == "--forceemp" )
80
				packages.SetForceEMP(true);
81
			else if ( argSwitch == "--gamerun" && !rest.Empty() )
82
			{
83
				gameArgs = SystemStringFromCyString(rest);
84
				break;
85
			}
86
			else if ( argSwitch == "--noresume" )
87
			{
88
				RegistryKey ^searchKey = Registry::CurrentUser->CreateSubKey("Software\\Egosoft\\PluginManagerSettings");
89
				if ( searchKey )
90
					searchKey->SetValue("DontAutoResume", 1);
91
			}
92
			else if ( argSwitch == "--resume" )
93
			{
94
				int zero = 0;
95
				RegistryKey ^searchKey = Registry::CurrentUser->CreateSubKey("Software\\Egosoft\\PluginManagerSettings");
96
				if ( searchKey )
97
					searchKey->SetValue("DontAutoResume", zero);
98
			}
99
		}
100
		// otherwise it must be a file to open
101
		else
102
			openPackage = SystemStringFromCyString(arg);
103
	}
104
 
105
	//TODO: Load languge xml
106
	//Language.LoadLanguages();
107
 
108
	// get the last language used
109
	RegistryKey ^searchKeyLang = Registry::CurrentUser->OpenSubKey("Software\\Egosoft\\PluginManagerSettings");
110
	if ( searchKeyLang )
111
	{
112
		int lang = System::Convert::ToInt32(searchKeyLang->GetValue("Language"));
113
		if ( lang )
114
			Language.SetLanguage(lang);
115
	}
116
 
117
 
118
	bool firstInstance = false;
119
	System::Threading::Mutex ^mut = gcnew System::Threading::Mutex(false, "Local\\XPluginManagerLite", firstInstance);
120
	if ( !firstInstance )
121
	{
122
		if ( openPackage )
123
		{
124
			if ( File::Exists(mydoc + "\\Egosoft\\pluginmanager_load.dat") )
125
			{
126
				StreamWriter ^sw = File::AppendText(mydoc + "\\Egosoft\\pluginmanager_load.dat");
127
				try 
128
				{
129
					sw->WriteLine("File: " + openPackage);
130
				}
131
				finally
132
				{
133
					if ( sw )
134
						delete (IDisposable ^)sw;
135
				}
136
			}
137
			else
138
			{
139
				StreamWriter ^sw = File::CreateText(mydoc + "\\Egosoft\\pluginmanager_load.dat");
140
				try 
141
				{
142
					sw->WriteLine("File: " + openPackage);
143
				}
144
				finally
145
				{
146
					if ( sw )
147
						delete (IDisposable ^)sw;
148
				}
149
			}
150
		}
151
		else if ( !silent )
152
			MessageBox::Show(SystemStringFromCyString(Language.GetText_Startup(LANGSTARTUP_ANOTHERINSTANCE)), SystemStringFromCyString(Language.GetText_Startup(LANGSTARTUP_ANOTHERINSTANCE_TITLE)), MessageBoxButtons::OK, MessageBoxIcon::Stop);
153
		return 0;
154
	}
155
 
156
	RegistryKey ^searchKey = Registry::CurrentUser->CreateSubKey("Software\\Egosoft\\PluginManagerSettings");
157
	if ( searchKey )
158
	{
159
		searchKey->SetValue("Run", System::Windows::Forms::Application::ExecutablePath);
160
		searchKey->SetValue("Version", (float)PMLVERSION);
161
		searchKey->SetValue("Beta", (int)PMLBETA);
162
	}
163
 
164
 
165
	if ( File::Exists(mydoc + "\\Egosoft\\pluginmanager_load.dat") )
166
		File::Delete(mydoc + "\\Egosoft\\pluginmanager_load.dat");
167
	if ( File::Exists(tempDir + "\\AutoUpdater_old.exe") )
168
		File::Delete(tempDir + "\\AutoUpdater_old.exe");
169
 
170
	packages.Startup(".", CyStringFromSystemString(tempDir), CyStringFromSystemString(mydoc), "");
171
	packages.SetRenameText(true);
172
 
173
	// Create the main window and run it
174
	MainGui ^gui = gcnew MainGui(&packages, &dirList, &remDirList, Advanced);
175
	gui->AddGameArgs(gameArgs);
176
 
177
	// load in the config file
178
	CFileIO configFile(CyStringFromSystemString(mydoc) + "/Egosoft/pluginmanager.dat");
179
	bool anyDirs = false;
180
	if ( configFile.Exists() )
181
	{
182
		std::vector<CyString> *readFile = configFile.ReadLines();
183
		if ( readFile )
184
		{
185
			for ( int i = 0; i < (int)readFile->size(); i++ )
186
			{
187
				CyString line(readFile->at(i));
188
				CyString cmd = line.GetToken(":", 1, 1).lower();
189
				CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
190
 
191
				if ( cmd == "dir" )
192
				{
193
					// first check its on the list
194
					if ( !dirList.FindString(rest) )
195
					{
196
						CyString gameName = packages.GetGameName(rest);
197
						if ( !gameName.Empty() )
198
						{
199
							int lang = packages.GetGameLanguage(rest);
200
							if ( lang )
201
								dirList.PushBack(rest, CyString::Number(lang) + "|" + gameName);
202
							else
203
								dirList.PushBack(rest, gameName);
204
							anyDirs = true;
205
						}
206
					}
207
				}
208
				else if ( cmd == "remdir" )
209
				{
210
					// first check its on the list
211
					if ( !remDirList.FindString(rest) )
212
					{
213
						remDirList.PushBack(rest);
214
						anyDirs = true;
215
					}
216
				}
217
				else if ( cmd == "experimental" )
218
					gui->SetExperimental(true);
219
				else if ( cmd == "filterships" )
220
					gui->SetShips(true);
221
				else if ( cmd == "filtersigned" )
222
					gui->SetOnlySigned(true);
223
				else if ( cmd == "modselectordetails" )
224
					gui->SetModSelectorDetails(true);
225
				else if ( cmd == "cheat" )
226
					gui->SetCheat(true);
227
				else if ( cmd == "downloadable" )
228
					gui->SetDownloadable(true);
229
				else if ( cmd == "noautoupdate" )
230
					gui->SetAutoUpdate(false);
231
				else if ( cmd == "managersize" )
232
					gui->SetSize(rest.GetToken(" ", 2, 2).ToInt(), rest.GetToken(" ", 1, 1).ToInt());
233
				else if ( cmd == "managerpos" )
234
					gui->Location = System::Drawing::Point(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2).ToInt());
235
				else if ( cmd == "managermax" )
236
					gui->WindowState = FormWindowState::Maximized;
237
				else if ( cmd == "tips" )
238
					gui->SetTips(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2).ToInt());
239
				else if ( cmd == "ignorejoy" )
240
					gui->SetIgnoreJoy(rest.ToInt());
241
				else if ( cmd == "savegamemanager" )
242
					gui->SetSaveGameManager(rest.ToInt());
243
				else if ( cmd == "restoremodified" ) {
244
					CPackages p;
245
					p.Startup(".", CyStringFromSystemString(tempDir), CyStringFromSystemString(mydoc), "");
246
					if ( p.Read(rest) ) {
247
						p.SetVanilla(false);
248
						p.PrepareEnableFromVanilla();
249
						p.EnablePreparedPackages(0, 0, 0);
250
						p.CloseDir();
251
					}
252
				}
253
			}
254
 
255
			delete readFile;
256
		}
257
	}
258
 
259
	CyStringList gameDirs;
260
	gameDirs.PushBack("HKCU\\Software\\Deepsilver\\X2 The Threat", "INSTALL_DIR");
261
	gameDirs.PushBack("HKCU\\Software\\Deepsilver\\X3 Reunion", "INSTALL_DIR");
262
	gameDirs.PushBack("HKCU\\Software\\Egosoft\\X3TC", "INSTALL_DIR");
263
	gameDirs.PushBack("Steam\\x2 - the threat");
264
	gameDirs.PushBack("Steam\\x3 - reunion");
265
	gameDirs.PushBack("Steam\\x3 terran conflict");
266
	// some custom directories to look for
267
	gameDirs.PushBack("%PROGRAMFILES%\\Egosoft\\X2 The Threat");
268
	gameDirs.PushBack("%PROGRAMFILES%\\Egosoft\\X3 Reunion");
269
	gameDirs.PushBack("%PROGRAMFILES%\\Egosoft\\X3 Terran Conflict");
270
	gameDirs.PushBack("C:\\Games\\X2");
271
	gameDirs.PushBack("C:\\Games\\X3");
272
	gameDirs.PushBack("C:\\Games\\X3TC");
273
	gameDirs.PushBack("D:\\Games\\X2");
274
	gameDirs.PushBack("D:\\Games\\X3");
275
	gameDirs.PushBack("D:\\Games\\X3TC");
276
 
277
	for ( SStringList *strNode = gameDirs.Head(); strNode; strNode = strNode->next )
278
	{
279
		CyString sFirst = strNode->str.GetToken("\\", 1, 1);
280
		CyString sRest = strNode->str.GetToken("\\", 2);
281
 
282
		if ( sFirst.Compare("HKCU") || sFirst.Compare("HKLM") )
283
		{
284
			RegistryKey ^searchKey = nullptr;
285
			if ( sFirst.Compare("HKCU") )
286
				searchKey = Registry::CurrentUser->OpenSubKey(SystemStringFromCyString(sRest));
287
			else if ( sFirst.Compare("HKLM") )
288
				searchKey = Registry::LocalMachine->OpenSubKey(SystemStringFromCyString(sRest));
289
 
290
			if ( searchKey )
291
			{
292
				System::String ^regRead = System::Convert::ToString(searchKey->GetValue(SystemStringFromCyString(strNode->data)));
293
				if ( regRead )
294
				{
295
					CyString dir = CyStringFromSystemString(regRead);
296
					gui->GetGameDirs(dir, anyDirs, anyDirs);
297
				}
298
			}
299
		}
300
		else if ( sFirst.Compare("Steam") )
301
		{
302
			RegistryKey ^steamKey = Registry::CurrentUser->OpenSubKey("Software\\Valve\\Steam");
303
			if ( steamKey )
304
			{
305
				System::String ^regRead = System::Convert::ToString(steamKey->GetValue("SteamPath"));
306
				if ( regRead )
307
				{
308
					CyString steamDir = CyStringFromSystemString(regRead);
309
					CyString dir = steamDir + "\\steamapps\\common\\" + sRest;
310
					dir = dir.FindReplace("/","\\");
311
					dir = dir.FindReplace("\\\\", "\\");
312
					gui->GetGameDirs(dir, anyDirs, anyDirs);
313
				}
314
			}
315
		}
316
		else
317
		{
318
			CyString dir = strNode->str;
319
			dir = dir.FindReplace("/","\\");
320
			dir = dir.FindReplace("\\\\", "\\");
321
			dir = dir.FindReplace("%PROGRAMFILES%", CyStringFromSystemString(progfile));
322
			gui->GetGameDirs(dir, anyDirs, anyDirs);
323
		}
324
	}
325
 
326
	// no directories?
327
	if ( dirList.Empty() )
328
	{
329
		OpenFileDialog ^ofd = gcnew OpenFileDialog();
330
		ofd->Filter = "X-Universe Executable|";
331
		String ^games = "";
332
		for ( int i = 0; i < packages.GetGameExe()->GetNumGames(); i++ )
333
		{
334
			SGameExe *exe = packages.GetGameExe()->GetGame(i);
335
			if ( i ) ofd->Filter += ";";
336
			ofd->Filter += SystemStringFromCyString(exe->sExe);
337
			games += "|" + SystemStringFromCyString(exe->sName) + "|" + SystemStringFromCyString(exe->sExe);
338
		}
339
		ofd->Filter += games;
340
		ofd->FilterIndex = 1;
341
		ofd->RestoreDirectory = true;
342
		if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
343
		{
344
			CyString dir = CyStringFromSystemString(IO::FileInfo(ofd->FileName).DirectoryName);
345
			if ( !dir.Empty() )
346
			{
347
				CyString gameName = packages.GetGameName(dir);
348
				if ( !gameName.Empty() )
349
				{
350
					remDirList.Remove(dir);
351
					gui->GetGameDirs(dir, false, true);
352
				}
353
			}
354
		}
355
	}
356
 
357
	// still no directories, quit
358
	if ( dirList.Empty() )
359
		return 1;
360
 
361
	CyString dir = dirList.First();
362
 
363
	StartUp ^startup = gcnew StartUp(&packages, &dir, (openPackage) ? true : false, Advanced);
364
	Application::Run(startup);
365
	if ( packages.IsOldPluginManager() )
366
	{
367
		if ( MessageBox::Show("Game directory: " + SystemStringFromCyString(dir) + "\nIs currently being controled by the old plugin manager\nIf you continue, you will be unable to use the old version again\nDo you wish to continue?", "Update Game Directory", MessageBoxButtons::YesNo, MessageBoxIcon::Question) != System::Windows::Forms::DialogResult::Yes )
368
			return 0;
369
	}
370
 
371
	// opening a package from command line
372
	if ( openPackage )
373
	{
374
		if ( gui->InstallPackage(openPackage, true, false, false) )
375
		{
376
			if ( !packages.GetModKey().Empty() )
377
				PluginManager::WriteRegistryValue(packages.GetModKey(), packages.GetSelectedModName());
378
			packages.CloseDir(0, 0, true);
379
			return 0;
380
		}
381
		return 1;
382
	}
383
 
384
	gui->UpdateDirList();
385
	gui->UpdateControls();
386
	gui->UpdatePackages();
387
	gui->StartCheckTimer();
388
 
389
	System::String ^mod = PluginManager::ReadRegistryValue(packages.GetModKey());
390
	packages.SetMod(CyStringFromSystemString(mod));
391
 
392
	gui->CheckProtectedDir();
393
	Application::Run(gui);
394
 
395
	// close directory 
396
	if ( packages.IsLoaded() )
397
	{
398
		if ( !packages.GetModKey().Empty() )
399
			PluginManager::WriteRegistryValue(packages.GetModKey(), packages.GetSelectedModName());
400
		if ( packages.AnyUnusedShared() )
401
		{
402
			if ( MessageBox::Show("You have some unused shared files, would you like to remove these?", "Remove Shared Files", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes)
403
				packages.RemoveUnusedSharedFiles();
404
		}
405
		packages.CloseDir(0, 0, true);
406
	}
407
 
408
	CyStringList restoreModified;
409
	if ( gui->GetDownloadFile() )
410
	{
411
		if ( System::IO::File::Exists(".\\AutoUpdater.exe") )
412
		{
413
			// rename the autoupdater
414
			System::String ^dir = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName;
415
			if ( System::IO::File::Exists(tempDir + "\\AutoUpdater_old.exe") )
416
				System::IO::File::Delete(tempDir + "\\AutoUpdater_old.exe");
417
			System::IO::File::Copy(dir + "\\AutoUpdater.exe", tempDir + "\\AutoUpdater_old.exe");
418
 
419
			System::Diagnostics::ProcessStartInfo ^info = nullptr;
420
			if ( System::IO::File::Exists(tempDir + "\\AutoUpdater_old.exe") )
421
				info = gcnew System::Diagnostics::ProcessStartInfo(tempDir + "\\AutoUpdater_old.exe");
422
			else 
423
			{
424
				MessageBox::Show("Error trying to update the Plugin Manager\nUnable to load AutoUpdater", "AutoUpdate", MessageBoxButtons::OK, MessageBoxIcon::Warning);
425
				System::Windows::Forms::Application::Restart();
426
				return 0;
427
			}
428
 
429
			if ( info )
430
			{
431
				info->WorkingDirectory = dir;
432
				info->Arguments = "\"" + gui->GetDownloadFile() + "\" \"" + System::Windows::Forms::Application::ExecutablePath + "\"";
433
				info->UseShellExecute = false;
434
				info->WindowStyle = System::Diagnostics::ProcessWindowStyle::Normal;
435
				System::Diagnostics::Process ^process = System::Diagnostics::Process::Start(info);
436
			}
437
		}
438
		else
439
		{
440
			MessageBox::Show("Error trying to update the Plugin Manager\nUnable to load AutoUpdater", "AutoUpdate", MessageBoxButtons::OK, MessageBoxIcon::Warning);
441
			System::Windows::Forms::Application::Restart();
442
		}
443
	}
444
	else if ( gui->GetRunFile() )
445
	{
446
		System::String ^dir = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName;
447
 
448
		// manager was run from the launcher, ie the launcher is still running, send a message to run the game instead of loading another one
449
		if ( fromLauncher )
450
		{
451
			StreamWriter ^sw = File::CreateText(mydoc + "\\Egosoft\\launchgame.dat");
452
			try 
453
			{
454
				sw->WriteLine("File:" + gui->GetRunFile());
455
				if ( gui->GetGameArgs() && gui->GetGameArgs()->Length )
456
					sw->WriteLine("Args:" + gui->GetGameArgs());
457
			}
458
			finally
459
			{
460
				if ( sw )
461
					delete (IDisposable ^)sw;
462
			}
463
		}
464
		else
465
		{
466
			if ( System::IO::File::Exists(dir + "\\GameLauncher.exe") )
467
			{
468
				System::Diagnostics::ProcessStartInfo ^info = gcnew System::Diagnostics::ProcessStartInfo(dir + "\\GameLauncher.exe");
469
				if ( info )
470
				{
471
					if ( packages.GetCurrentGameFlags() & EXEFLAG_ADDON ) {
472
						CPackages p;
473
						p.Startup(".", CyStringFromSystemString(tempDir), CyStringFromSystemString(mydoc), "");
474
						CyString baseDir = CFileIO(CyStringFromSystemString(gui->GetRunFile())).GetDir();
475
						if ( p.Read(baseDir) ) {
476
							if ( !p.IsVanilla() ) {
477
								p.SetVanilla(true);
478
								p.PrepareDisableForVanilla();
479
								p.EnablePreparedPackages(0, 0, 0);
480
								restoreModified.PushBack(baseDir);
481
							}
482
							p.CloseDir();							
483
						}
484
					}
485
 
486
					info->WorkingDirectory = dir;
487
					if ( gui->GetGameArgs() && gui->GetGameArgs()->Length )
488
						info->Arguments = "\"" + gui->GetRunFile() + "\" \"" + System::Windows::Forms::Application::ExecutablePath + "\" \"" + gui->GetGameArgs() + "\"";
489
					else
490
						info->Arguments = "\"" + gui->GetRunFile() + "\" \"" + System::Windows::Forms::Application::ExecutablePath + "\"";
491
					info->UseShellExecute = false;
492
					info->WindowStyle = System::Diagnostics::ProcessWindowStyle::Normal;
493
					System::Diagnostics::Process ^process = System::Diagnostics::Process::Start(info);
494
				}
495
			}
496
		}
497
	}
498
 
499
	// write config
500
	std::vector<CyString> writeLines;
501
	for ( SStringList *strNode = dirList.Head(); strNode; strNode = strNode->next )
502
	{
503
		writeLines.push_back(CyString("Dir:") + strNode->str);
504
		CyString data;
505
		if ( strNode->data.IsIn("|") )
506
		{
507
			data = CPackages::ConvertLanguage(strNode->data.GetToken("|", 1, 1).ToInt()) + "|";
508
			data += strNode->data.GetToken("|", 2);
509
		}
510
		else
511
			data = strNode->data;
512
 
513
		CyString exe = CFileIO(packages.GetGameExe()->GetGameRunExe(strNode->str)).GetFullFilename();
514
		writeLines.push_back(CyString("DirExe:") + data + "|" + exe);
515
 
516
		// do the log files
517
		writeLines.push_back(CyString("GameLog:") + packages.GetLogDirectory(exe) + "|" + exe);
518
 
519
	}
520
	for ( SStringList *strNode = remDirList.Head(); strNode; strNode = strNode->next )
521
		writeLines.push_back(CyString("RemDir:") + strNode->str);
522
	if ( gui->IsExperimental() )
523
		writeLines.push_back("Experimental:");
524
	if ( gui->IsShips() )
525
		writeLines.push_back("FilterShips:");
526
	if ( gui->IsOnlySigned() )
527
		writeLines.push_back("FilterSigned:");
528
	if ( gui->IsCheat() )
529
		writeLines.push_back("Cheat:");
530
	writeLines.push_back(CyString("SaveGameManager:") + (long)gui->GetSaveGameManager());
531
	if ( gui->IsDownloadable() )
532
		writeLines.push_back("Downloadable:");
533
	if ( gui->IsModSelectorDetailsShowing() )
534
		writeLines.push_back("ModSelectorDetails:");
535
	if ( !gui->IsAutoUpdate() )
536
		writeLines.push_back("NoAutoUpdate:");
537
	if ( gui->WindowState == FormWindowState::Normal )
538
	{
539
		writeLines.push_back(CyString("ManagerSize:") + (long)gui->Size.Height + " " + (long)gui->Size.Width);
540
		writeLines.push_back(CyString("ManagerPos:") + (long)gui->Location.X + " " + (long)gui->Location.Y);
541
	}
542
	else
543
	{
544
		writeLines.push_back(CyString("ManagerPos:") + (long)gui->RestoreBounds.Location.X + " " + (long)gui->RestoreBounds.Location.Y);
545
		writeLines.push_back(CyString("ManagerSize:") + (long)gui->RestoreBounds.Size.Height + " " + (long)gui->RestoreBounds.Size.Width);
546
	}
547
 
548
	if ( gui->WindowState == FormWindowState::Maximized )
549
		writeLines.push_back("ManagerMax:");
550
	if ( gui->GetIgnoreJoy() )
551
		writeLines.push_back(CyString("IgnoreJoy:") + gui->GetIgnoreJoy());
552
 
553
	for ( int i = 0; i < gui->GetMaxTips(); i++ )
554
	{
555
		int tips = gui->GetTips(i);
556
		if ( tips == -1 )
557
			continue;
558
		writeLines.push_back(CyString("Tips: ") + (long)i + " " + (long)tips);
559
	}
560
 
561
	for ( SStringList *rm = restoreModified.Head(); rm; rm = rm->next ) {
562
		writeLines.push_back(CyString("RestoreModified: ") + rm->str);
563
	}
564
 
565
	// write settings
566
	configFile.WriteFile(&writeLines);
567
 
568
	return 0;
569
}