Subversion Repositories spk

Rev

Rev 68 | Rev 95 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68 Rev 94
Line 47... Line 47...
47
 
47
 
48
		void parseCommandArguments(array<System::String ^> ^args);
48
		void parseCommandArguments(array<System::String ^> ^args);
49
 
49
 
50
		int GetHighestGame()
50
		int GetHighestGame()
51
		{
51
		{
52
			int highest = 1;
-
 
53
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
54
			{
-
 
55
				if ( gd->iGame > highest )
-
 
56
					highest = gd->iGame;
-
 
57
			}
-
 
58
			return highest;
52
			return _pGameDir->highestGame();
59
		}
53
		}
60
 
54
 
61
		void ModMerge()
55
		void ModMerge()
62
		{
56
		{
63
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
57
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
64
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
58
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
65
			merge->TopMost = true;
59
			merge->TopMost = true;
66
			if ( !m_pGameDir->empty() )
60
			if ( !_pGameDir->isEmpty() ) 
67
				merge->SetGameDir(-1, _US(m_pGameDir->Front()->Data()->dir));
61
				merge->SetGameDir(-1, _US(_pGameDir->first()));
68
			merge->ShowDialog(this);
62
			merge->ShowDialog(this);
69
		}
63
		}
70
 
64
 
71
		void ModDiffDialog()
65
		void ModDiffDialog()
72
		{
66
		{
73
			ModDiff ^diff = gcnew ModDiff(m_pGameDir, m_pPackages);
67
			ModDiff ^diff = gcnew ModDiff(_pGameDir, m_pPackages);
74
			diff->ShowDialog(this);
68
			diff->ShowDialog(this);
75
		}
69
		}
76
 
70
 
77
		void OpenArchive()
71
		void OpenArchive()
78
		{
72
		{
Line 90... Line 84...
90
				this->backgroundWorker1->RunWorkerAsync();
84
				this->backgroundWorker1->RunWorkerAsync();
91
				m_pWait->ShowDialog(this);
85
				m_pWait->ShowDialog(this);
92
			}
86
			}
93
		}
87
		}
94
 
88
 
95
		CyStringList *FindLasersList(int game)
89
		String ^ParseText(int game, String ^text)
96
		{
90
		{
97
			// return the list
-
 
98
			if ( game < m_pLasers->size() )
-
 
99
			{
-
 
100
				if ( !m_pLasers->Get(game)->Empty() )
-
 
101
					return m_pLasers->Get(game);
-
 
102
			}
-
 
103
 
-
 
104
			// other wise create the list we need
-
 
105
			// first we need to create entries for the ones we are not using
-
 
106
			while ( m_pLasers->size() < game )
-
 
107
				m_pLasers->push_back(new CyStringList);
-
 
108
 
-
 
109
			CyStringList *list = new CyStringList;
-
 
110
			m_pLasers->push_back(list);
-
 
111
 
-
 
112
			return list;
-
 
113
		}
-
 
114
 
-
 
115
		CyStringList *GetLasers(int game)
-
 
116
		{
-
 
117
			CyStringList *list = FindLasersList(game);
-
 
118
			if ( !list ) return NULL;
-
 
119
 
-
 
120
			if ( list->Empty() )
-
 
121
			{
-
 
122
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
123
				{
-
 
124
					if ( gd->iGame != game )
-
 
125
						continue;
-
 
126
					int e = m_pPackages->ExtractGameFile("types\\TLaser.pck", m_pPackages->GetTempDirectory() + "/TLaser.txt", gd->dir);
-
 
127
					if ( e )
-
 
128
					{
-
 
129
						CFileIO File((e == -1) ? "TLaser.txt" : m_pPackages->GetTempDirectory() + "/TLaser.txt");
-
 
130
						CyStringList *lines = File.ReadLinesStr();
-
 
131
						if ( lines )
-
 
132
						{
-
 
133
							int itemsRemaining = -1;
-
 
134
							for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
135
							{
-
 
136
								str->str.RemoveChar('\r');
-
 
137
								str->str.RemoveChar(9);
-
 
138
								str->str.RemoveFirstSpace();
-
 
139
 
-
 
140
								if ( str->str.Empty() )
-
 
141
									continue;
-
 
142
								if ( str->str[0] == '/' )
-
 
143
									continue;
-
 
144
 
-
 
145
								if ( itemsRemaining == -1 )
-
 
146
									itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
147
								else
-
 
148
								{
-
 
149
									list->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
-
 
150
									--itemsRemaining;
-
 
151
								}
-
 
152
							}
-
 
153
 
-
 
154
							delete lines;
-
 
155
							return list;
-
 
156
						}
-
 
157
					}
-
 
158
				}
-
 
159
			}
-
 
160
 
-
 
161
			return list;
-
 
162
		}
-
 
163
 
-
 
164
		CyStringList *GetMissiles(int game)
-
 
165
		{
-
 
166
			// return the list
-
 
167
			if ( game < m_pMissiles->size() )
-
 
168
			{
-
 
169
				if ( !m_pMissiles->Get(game)->Empty() )
-
 
170
					return m_pMissiles->Get(game);
-
 
171
			}
-
 
172
 
-
 
173
			// other wise create the list we need
-
 
174
			// first we need to create entries for the ones we are not using
-
 
175
			while ( m_pMissiles->size() < game )
-
 
176
				m_pMissiles->push_back(new CyStringList);
-
 
177
 
-
 
178
			CyStringList *list = new CyStringList;
-
 
179
			m_pMissiles->push_back(list);
-
 
180
 
-
 
181
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
182
			{
-
 
183
				if ( gd->iGame != game )
-
 
184
					continue;
-
 
185
				int e = m_pPackages->ExtractGameFile("types\\TMissiles.pck", m_pPackages->GetTempDirectory() + "/TMissiles.txt", gd->dir);
-
 
186
				if ( e )
-
 
187
				{
-
 
188
					CFileIO File((e == -1) ? "TMissiles.txt" : m_pPackages->GetTempDirectory() + "/TMissiles.txt");
-
 
189
					CyStringList *lines = File.ReadLinesStr();
-
 
190
					if ( lines )
-
 
191
					{
-
 
192
						int itemsRemaining = -1;
-
 
193
						for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
194
						{
-
 
195
							str->str.RemoveChar('\r');
-
 
196
							str->str.RemoveChar(9);
-
 
197
							str->str.RemoveFirstSpace();
-
 
198
 
-
 
199
							if ( str->str.Empty() )
-
 
200
								continue;
-
 
201
							if ( str->str[0] == '/' )
-
 
202
								continue;
-
 
203
 
-
 
204
							if ( itemsRemaining == -1 )
-
 
205
								itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
206
							else
-
 
207
							{
-
 
208
								list->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
-
 
209
								--itemsRemaining;
-
 
210
							}
-
 
211
						}
-
 
212
 
-
 
213
						delete lines;
-
 
214
						return list;
-
 
215
					}
-
 
216
				}
-
 
217
			}
-
 
218
 
-
 
219
			return list;
-
 
220
		}
-
 
221
 
-
 
222
		CyStringList *GetShields()
-
 
223
		{
-
 
224
			if ( !m_pShields )
-
 
225
			{
-
 
226
				bool found = false;
-
 
227
				for ( int game = 2; game >= 0; game-- )
-
 
228
				{
-
 
229
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
230
					{
-
 
231
						if ( gd->iGame != game )
-
 
232
							continue;
-
 
233
						if ( m_pPackages->ExtractGameFile("types\\TShields.pck", m_pPackages->GetTempDirectory() + "/TShields.txt", gd->dir) )
-
 
234
						{
-
 
235
							if ( !m_pShields )
-
 
236
								m_pShields = new CyStringList;
-
 
237
 
-
 
238
							CFileIO File(m_pPackages->GetTempDirectory() + "/TShields.txt");
-
 
239
							CyStringList *lines = File.ReadLinesStr();
-
 
240
							if ( lines )
-
 
241
							{
-
 
242
								int itemsRemaining = -1;
-
 
243
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
244
								{
-
 
245
									str->str.RemoveChar('\r');
-
 
246
									str->str.RemoveChar(9);
-
 
247
									str->str.RemoveFirstSpace();
-
 
248
 
-
 
249
									if ( str->str.Empty() )
-
 
250
										continue;
-
 
251
									if ( str->str[0] == '/' )
-
 
252
										continue;
-
 
253
 
-
 
254
									if ( itemsRemaining == -1 )
-
 
255
										itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
256
									else
-
 
257
									{
-
 
258
										m_pShields->PushBack(str->str, CyStringFromSystemString(this->FindText(game, TEXTPAGE_OBJECTS, str->str.GetToken(";", 7, 7).ToInt())));
-
 
259
										--itemsRemaining;
-
 
260
									}
-
 
261
								}
-
 
262
 
-
 
263
								delete lines;
-
 
264
								found = true;
-
 
265
								break;
-
 
266
							}
-
 
267
						}
-
 
268
					}
-
 
269
 
-
 
270
					if ( found )
-
 
271
						break;
-
 
272
				}
-
 
273
			}
-
 
274
 
-
 
275
			return m_pShields;
-
 
276
		}
-
 
277
 
-
 
278
		CyStringList *GetCockpits(int game)
-
 
279
		{
-
 
280
			// return the list
-
 
281
			if ( game < m_pCockpits->size() )
-
 
282
			{
-
 
283
				if ( !m_pCockpits->Get(game)->Empty() )
-
 
284
					return m_pCockpits->Get(game);
-
 
285
			}
-
 
286
 
-
 
287
			// other wise create the list we need
-
 
288
			// first we need to create entries for the ones we are not using
-
 
289
			while ( m_pCockpits->size() < game )
-
 
290
				m_pCockpits->push_back(new CyStringList);
-
 
291
 
-
 
292
			CyStringList *list = new CyStringList;
-
 
293
			m_pCockpits->push_back(list);
-
 
294
 
-
 
295
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
296
			{
-
 
297
				if ( gd->iGame != game )
-
 
298
					continue;
-
 
299
				if ( m_pPackages->ExtractGameFile("types\\TCockpits.pck", m_pPackages->GetTempDirectory() + "/TCockpits.txt", gd->dir) )
-
 
300
				{
-
 
301
					CFileIO File(m_pPackages->GetTempDirectory() + "/TCockpits.txt");
-
 
302
					CyStringList *lines = File.ReadLinesStr();
-
 
303
					if ( lines )
-
 
304
					{
-
 
305
						int itemsRemaining = -1;
-
 
306
						for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
307
						{
-
 
308
							str->str.RemoveChar('\r');
-
 
309
							str->str.RemoveChar(9);
-
 
310
							str->str.RemoveFirstSpace();
-
 
311
 
-
 
312
							if ( str->str.Empty() )
-
 
313
								continue;
-
 
314
							if ( str->str[0] == '/' )
-
 
315
								continue;
-
 
316
 
-
 
317
							if ( itemsRemaining == -1 )
-
 
318
								itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
319
							else
-
 
320
							{
-
 
321
								list->PushBack(str->str, str->str.GetToken(";", 19, 19));
-
 
322
								--itemsRemaining;
-
 
323
							}
-
 
324
						}
-
 
325
 
-
 
326
						delete lines;
-
 
327
						File.remove();
-
 
328
						return list;
-
 
329
					}
-
 
330
					File.remove();
-
 
331
				}
-
 
332
			}
-
 
333
			return list;
-
 
334
		}
-
 
335
 
-
 
336
		CyStringList *GetComponentSections()
-
 
337
		{
-
 
338
			// need to load data
-
 
339
			if ( !m_pComponents )
-
 
340
			{
-
 
341
				bool found = false;
-
 
342
				for ( int game = 2; game >= 0; game-- )
-
 
343
				{
-
 
344
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
345
					{
-
 
346
						if ( gd->iGame != game )
-
 
347
							continue;
-
 
348
						if ( m_pPackages->ExtractGameFile("types\\Components.pck", m_pPackages->GetTempDirectory() + "/components.txt", gd->dir) )
-
 
349
						{
-
 
350
							if ( !m_pComponents )
-
 
351
								m_pComponents = new CyStringList;
-
 
352
							CFileIO File(m_pPackages->GetTempDirectory() + "/components.txt");
-
 
353
							CyStringList *lines = File.ReadLinesStr();
-
 
354
							if ( lines )
-
 
355
							{
-
 
356
								int sectionRemaining = 0;
-
 
357
								int itemsRemaining = 0;
-
 
358
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
359
								{
-
 
360
									str->str.RemoveChar('\r');
-
 
361
									str->str.RemoveChar(9);
-
 
362
									str->str.RemoveFirstSpace();
-
 
363
 
-
 
364
									if ( str->str.Empty() )
-
 
365
										continue;
-
 
366
									if ( str->str[0] == '/' )
-
 
367
										continue;
-
 
368
 
-
 
369
									if ( itemsRemaining )
-
 
370
										--itemsRemaining;
-
 
371
									else if ( !sectionRemaining )
-
 
372
									{
-
 
373
										sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
374
										CyString sec = str->str.GetToken(";", 1, 1);
-
 
375
										if ( !sec.Empty() )
-
 
376
											m_pComponents->PushBack(sec);
-
 
377
									}
-
 
378
									else if ( !itemsRemaining )
-
 
379
									{
-
 
380
										itemsRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
381
										--sectionRemaining;
-
 
382
									}
-
 
383
								}
-
 
384
 
-
 
385
								delete lines;
-
 
386
								found = true;
-
 
387
								break;
-
 
388
							}
-
 
389
						}
-
 
390
					}
-
 
391
 
-
 
392
					if ( found )
-
 
393
						break;
-
 
394
				}
-
 
395
 
-
 
396
				// still empty
-
 
397
				if ( !m_pComponents )
-
 
398
					m_pComponents = new CyStringList;
-
 
399
				if ( m_pComponents->Empty() )
-
 
400
				{
-
 
401
					m_pComponents->PushBack("SCTYPE_LASER");
-
 
402
					m_pComponents->PushBack("SCTYPE_COCKPIT");
-
 
403
					m_pComponents->PushBack("SCTYPE_DOCKING");
-
 
404
				}
-
 
405
			}
-
 
406
			return m_pComponents;
-
 
407
		}
-
 
408
		
-
 
409
		CyStringList *GetDummySections()
-
 
410
		{
-
 
411
			if ( !m_pDummies )
-
 
412
			{
-
 
413
				bool found = false;
-
 
414
				for ( int game = 2; game >= 0; game-- )
-
 
415
				{
-
 
416
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
417
					{
-
 
418
						if ( gd->iGame != game )
-
 
419
							continue;
-
 
420
						if ( m_pPackages->ExtractGameFile("types\\Dummies.pck", m_pPackages->GetTempDirectory() + "/Dummies.txt", gd->dir) )
-
 
421
						{
-
 
422
							if ( !m_pDummies )
-
 
423
								m_pDummies = new CyStringList;
-
 
424
							CFileIO File(m_pPackages->GetTempDirectory() + "/Dummies.txt");
-
 
425
							CyStringList *lines = File.ReadLinesStr();
-
 
426
							if ( lines )
-
 
427
							{
-
 
428
								int sectionRemaining = 0;
-
 
429
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
430
								{
-
 
431
									str->str.RemoveChar('\r');
-
 
432
									str->str.RemoveChar(9);
-
 
433
									str->str.RemoveFirstSpace();
-
 
434
 
-
 
435
									if ( str->str.Empty() )
-
 
436
										continue;
-
 
437
									if ( str->str[0] == '/' )
-
 
438
										continue;
-
 
439
 
-
 
440
									if ( !sectionRemaining )
-
 
441
									{
-
 
442
										sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
443
										CyString sec = str->str.GetToken(";", 1, 1);
-
 
444
										if ( !sec.Empty() )
-
 
445
											m_pDummies->PushBack(sec);
-
 
446
									}
-
 
447
									else
-
 
448
										--sectionRemaining;
-
 
449
								}
-
 
450
 
-
 
451
								delete lines;
-
 
452
								found = true;
-
 
453
								break;
-
 
454
							}
-
 
455
						}
-
 
456
					}
-
 
457
 
-
 
458
					if ( found )
-
 
459
						break;
-
 
460
				}
-
 
461
				// still empty
-
 
462
				if ( !m_pDummies )
-
 
463
					m_pDummies = new CyStringList;
-
 
464
				if ( m_pDummies->Empty() )
-
 
465
				{
-
 
466
					m_pDummies->PushBack("SDTYPE_ANIMATED");
-
 
467
					m_pDummies->PushBack("SDTYPE_DOCK");
-
 
468
					m_pDummies->PushBack("SDTYPE_DOORWAY");
-
 
469
					m_pDummies->PushBack("SDTYPE_GUN");
-
 
470
					m_pDummies->PushBack("SDTYPE_CONNTECTION");
-
 
471
				}
-
 
472
			}
-
 
473
			return m_pDummies;
-
 
474
		}
-
 
475
 
-
 
476
		CyStringList *GetBodiesSections()
-
 
477
		{
-
 
478
			if ( !m_pBodies )
-
 
479
			{
-
 
480
				bool found = false;
-
 
481
				for ( int game = 2; game >= 0; game-- )
-
 
482
				{
-
 
483
					for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
-
 
484
					{
-
 
485
						if ( gd->iGame != game )
-
 
486
							continue;
-
 
487
						if ( m_pPackages->ExtractGameFile("types\\Bodies.pck", m_pPackages->GetTempDirectory() + "/Bodies.txt", gd->dir) )
-
 
488
						{
-
 
489
							if ( !m_pBodies )
-
 
490
								m_pBodies = new CyStringList;
-
 
491
							CFileIO File(m_pPackages->GetTempDirectory() + "/Bodies.txt");
-
 
492
							CyStringList *lines = File.ReadLinesStr();
-
 
493
							if ( lines )
-
 
494
							{
-
 
495
								int sectionRemaining = 0;
-
 
496
								for ( SStringList *str = lines->Head(); str; str = str->next )
-
 
497
								{
-
 
498
									str->str.RemoveChar('\r');
-
 
499
									str->str.RemoveChar(9);
-
 
500
									str->str.RemoveFirstSpace();
-
 
501
 
-
 
502
									if ( str->str.Empty() )
-
 
503
										continue;
-
 
504
									if ( str->str[0] == '/' )
-
 
505
										continue;
-
 
506
 
-
 
507
									if ( !sectionRemaining )
-
 
508
									{
-
 
509
										sectionRemaining = str->str.GetToken(";", 2, 2).ToInt();
-
 
510
										CyString sec = str->str.GetToken(";", 1, 1);
-
 
511
										if ( !sec.Empty() )
-
 
512
											m_pBodies->PushBack(sec);
-
 
513
									}
-
 
514
									else
-
 
515
									{
-
 
516
										sectionRemaining -= (str->str.NumToken(";") - 1);
-
 
517
									}
-
 
518
								}
-
 
519
 
-
 
520
								delete lines;
-
 
521
								found = true;
-
 
522
								break;
-
 
523
							}
-
 
524
						}
-
 
525
					}
-
 
526
 
-
 
527
					if ( found )
-
 
528
						break;
-
 
529
				}
-
 
530
				// still empty
-
 
531
				if ( !m_pBodies )
-
 
532
					m_pBodies = new CyStringList;
-
 
533
				if ( m_pBodies->Empty() )
-
 
534
				{
-
 
535
					m_pBodies->PushBack("SBTYPE_2D");
-
 
536
					m_pBodies->PushBack("SBTYPE_FACECAMERA");
-
 
537
					m_pBodies->PushBack("SBTYPE_2D2");
-
 
538
					m_pBodies->PushBack("SBTYPE_2DY");
-
 
539
					m_pBodies->PushBack("SBTYPE_LOGO");
-
 
540
					m_pBodies->PushBack("SBTYPE_FC");
-
 
541
					m_pBodies->PushBack("SBTYPE_TURRET");
-
 
542
					m_pBodies->PushBack("SBTYPE_JET");
-
 
543
					m_pBodies->PushBack("SBTYPE_RADAR");
-
 
544
					m_pBodies->PushBack("SBTYPE_CONTAINER");
-
 
545
					m_pBodies->PushBack("SBTYPE_DISPLAY");
-
 
546
					m_pBodies->PushBack("SBTYPE_DOCKPOINT");
-
 
547
					m_pBodies->PushBack("SBTYPE_SMALLJET");
-
 
548
				}
-
 
549
			}
-
 
550
			return m_pBodies;
-
 
551
		}
-
 
552
 
-
 
553
		String ^ParseText(int game, String ^text)
-
 
554
		{
-
 
555
			String ^t = text;
91
			String ^t = text;
556
 
92
 
557
			bool found = true;
93
			bool found = true;
558
			int pos = 0;
94
			int pos = 0;
559
			while (found)
95
			while (found)
560
			{
96
			{
Line 578... Line 114...
578
						}
114
						}
579
					}
115
					}
580
				}
116
				}
581
			}
117
			}
582
			return t;
118
			return t;
583
		}
119
		}
584
 
120
 
585
		SGameDir *findGameDir(int iGame)
121
		CGameDirectories *gameDirectories()
586
		{
122
		{
587
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
-
 
588
				if ( gd->iGame == iGame ) return gd;
123
			return _pGameDir;
589
			}
124
		}
590
 
125
 
591
			return NULL;
126
		void LoadText()
-
 
127
		{
-
 
128
			this->LoadText(false, false);
592
		}
129
		}
593
 
130
 
594
		String ^FindText(int game, int page, int id)
131
		String ^FindText(int game, int page, int id)
595
		{
132
		{
596
			this->LoadText(false, false);
133
			this->LoadText(false, false);
597
 
134
 
598
			String ^text;
-
 
599
			if ( game == -1 ) {
-
 
600
				for ( int game = (GAME_MAX - 1); game >= 0; game-- ) {
135
			Utils::String text = _pGameDir->findText(game, 44, page, id);
601
					SGameDir *gd = findGameDir(game - 1);
-
 
602
					if ( !gd ) continue;
136
			if ( !text.empty() ) {
603
					if ( gd->pVfs->textExists(44, page, id) ) {
-
 
604
						text = ParseText(game, SystemStringFromCyString(gd->pVfs->findText(44, page, id)));
-
 
605
						break;
-
 
606
					}
-
 
607
				}
-
 
608
			}
-
 
609
			else
-
 
610
			{
-
 
611
				SGameDir *gd = findGameDir(game);
137
				return ParseText(game, _US(text));
612
				if ( gd ) {
-
 
613
					if ( gd->pVfs->textExists(44, page, id) ) {
-
 
614
						text = ParseText(game, SystemStringFromCyString(gd->pVfs->findText(44, page, id)));
-
 
615
					}
-
 
616
				}
-
 
617
			}
138
			}
618
 
139
 
619
			return text;
140
			return nullptr;
620
		}
141
		}
621
 
142
 
622
		void UpdateStatus()
143
		void UpdateStatus()
623
		{
144
		{
624
			bool e = (this->tabControl1->HasChildren) ? true : false;
145
			bool e = (this->tabControl1->HasChildren) ? true : false;
625
 
146
 
626
			BaseForm ^active = this->GetActiveChild();
147
			BaseForm ^active = this->GetActiveChild();
627
			if ( active && active->GetFormType() == FORMTYPE_SINGLE )
148
			if ( active && active->GetFormType() == FORMTYPE_SINGLE )
628
			{
149
			{
629
				CBaseFile *activePackage = ((PackageForm ^)active)->GetPackage();
150
				CBaseFile *activePackage = ((PackageForm ^)active)->GetPackage();
630
				if ( !activePackage )
151
				if ( !activePackage )
631
					e = false;
152
					e = false;
632
				else
153
				else
633
					this->StatusFiles->Text = "Files: " + activePackage->GetFileList()->size() + " (" + SystemStringFromCyString(activePackage->GetFullFileSizeString()) + ")";
154
					this->StatusFiles->Text = "Files: " + activePackage->GetFileList()->size() + " (" + SystemStringFromCyString(activePackage->GetFullFileSizeString()) + ")";
634
			}
155
			}
635
			else if ( active && active->GetFormType() == FORMTYPE_MULTI )
156
			else if ( active && active->GetFormType() == FORMTYPE_MULTI )
636
			{
157
			{
637
				CMultiSpkFile *activePackage = ((MultiForm ^)active)->GetPackage();
158
				CMultiSpkFile *activePackage = ((MultiForm ^)active)->GetPackage();
638
				if ( !activePackage )
159
				if ( !activePackage )
639
					e = false;
160
					e = false;
640
				else
161
				else
641
					this->StatusFiles->Text = "Files: " + activePackage->GetAvailableFiles() + " (" + SystemStringFromCyString(SPK::GetSizeString(activePackage->GetFileSize())) + ")";
162
					this->StatusFiles->Text = "Files: " + activePackage->GetAvailableFiles() + " (" + SystemStringFromCyString(SPK::GetSizeString(activePackage->GetFileSize())) + ")";
642
			}
163
			}
643
			else
164
			else
644
				e = false;
165
				e = false;
645
 
166
 
646
			if ( !e  )
167
			if ( !e  )
647
				this->StatusFiles->Text = "";
168
				this->StatusFiles->Text = "";
648
		}
169
		}
649
 
170
 
650
		void UpdateDisplay()
171
		void UpdateDisplay()
651
		{
172
		{
652
			bool e = (this->tabControl1->HasChildren) ? true : false;
173
			bool e = (this->tabControl1->HasChildren) ? true : false;
653
 
174
 
654
			BaseForm ^active = this->GetActiveChild();
175
			BaseForm ^active = this->GetActiveChild();
Line 679... Line 200...
679
			FileExplorer ^file = gcnew FileExplorer(this, m_pPackages);
200
			FileExplorer ^file = gcnew FileExplorer(this, m_pPackages);
680
			file->Show(this);
201
			file->Show(this);
681
		}
202
		}
682
 
203
 
683
		void OpenFile(String ^filename)
204
		void OpenFile(String ^filename)
684
		{
205
		{
685
			ArrayList ^a = gcnew ArrayList();
206
			ArrayList ^a = gcnew ArrayList();
686
			a->Add(filename);
207
			a->Add(filename);
687
 
208
 
688
			this->OpenFiles(a, false, true);
209
			this->OpenFiles(a, false, true);
689
		}
210
		}
Line 698... Line 219...
698
			{
219
			{
699
				delete components;
220
				delete components;
700
			}
221
			}
701
			delete m_pLoadedList;
222
			delete m_pLoadedList;
702
			delete m_pPackages;
223
			delete m_pPackages;
703
			m_pGameDir->MemoryClear();
-
 
704
			delete m_pGameDir;
-
 
705
 
-
 
706
			for ( CyStringList *list = m_pLasers->First(); list; list = m_pLasers->Next() )
-
 
707
				delete list;
-
 
708
			for ( CyStringList *list = m_pMissiles->First(); list; list = m_pMissiles->Next() )
-
 
709
				delete list;
-
 
710
			for ( CyStringList *list = m_pCockpits->First(); list; list = m_pCockpits->Next() )
-
 
711
				delete list;
-
 
712
			delete m_pLasers;
-
 
713
			delete m_pMissiles;
-
 
714
			delete m_pCockpits;
-
 
715
			if ( m_pShields )
-
 
716
				delete m_pShields;
-
 
717
			if ( m_pComponents )
-
 
718
				delete m_pComponents;
-
 
719
			if ( m_pDummies )
-
 
720
				delete m_pDummies;
-
 
721
			if ( m_pBodies )
-
 
722
				delete m_pBodies;
-
 
723
			delete m_settings;
224
			delete m_settings;
724
		}
225
		}
725
 
226
 
726
	protected: 
227
	protected: 
727
		bool			 m_bAutoClose;
228
		bool			 m_bAutoClose;
728
		int				 m_iLocX;
229
		int				 m_iLocX;
729
		int				 m_iLocY;
230
		int				 m_iLocY;
730
		CLinkList<CyStringList> *m_pLasers;
-
 
731
		CLinkList<CyStringList> *m_pMissiles;
-
 
732
		CLinkList<CyStringList> *m_pCockpits;
-
 
733
		CyStringList	*m_pShields;
-
 
734
		CyStringList	*m_pLoadedList;
231
		CyStringList	*m_pLoadedList;
735
		CPackages *m_pPackages;
232
		CPackages *m_pPackages;
736
		CLinkList<SGameDir>	*m_pGameDir;
233
		SPK::CGameDirectories	*_pGameDir;
737
		CyStringList	*m_pComponents;
-
 
738
		CyStringList	*m_pDummies;
-
 
739
		CyStringList	*m_pBodies;
-
 
-
 
234
 
740
		SSettings		*m_settings;
235
		SSettings		*m_settings;
741
		bool			 m_bTextLoaded;
236
		bool			 m_bTextLoaded;
742
		String			^m_sConvertFile;
237
		String			^m_sConvertFile;
743
		Waiting			^m_pWait;
238
		Waiting			^m_pWait;
744
		CBaseFile		*m_pConverted;
239
		CBaseFile		*m_pConverted;
Line 812... Line 307...
812
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator11;
307
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator11;
813
private: System::Windows::Forms::ToolStripMenuItem^  fileExplorerToolStripMenuItem;
308
private: System::Windows::Forms::ToolStripMenuItem^  fileExplorerToolStripMenuItem;
814
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromVFSToolStripMenuItem;
309
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromVFSToolStripMenuItem;
815
 
310
 
816
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
311
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
817
 
312
 
818
 
313
 
819
	private:
314
	private:
820
		BaseForm ^GetActiveChild()
315
		BaseForm ^GetActiveChild()
821
		{
316
		{
822
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
317
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
823
			 for ( int i = 0; i < children->Length; i++ )
318
			 for ( int i = 0; i < children->Length; i++ )
Line 849... Line 344...
849
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.spk"), false, false);
344
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.spk"), false, false);
850
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.xsp"), false, false);
345
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.xsp"), false, false);
851
		}
346
		}
852
 
347
 
853
		void OpenFiles(cli::array<System::String ^> ^list, bool checkExtension, bool display)
348
		void OpenFiles(cli::array<System::String ^> ^list, bool checkExtension, bool display)
854
		{
349
		{
855
			if ( !list )
350
			if ( !list )
856
				return;
351
				return;
857
 
352
 
858
			for ( int i = 0; i < list->Length; i++ )
353
			for ( int i = 0; i < list->Length; i++ )
859
				this->Open(list[i], display, checkExtension);
354
				this->Open(list[i], display, checkExtension);
860
 
355
 
861
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
356
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
862
			for ( int i = 0; i < children->Length; i++ )
357
			for ( int i = 0; i < children->Length; i++ )
863
			{
358
			{
864
				BaseForm ^childForm = (BaseForm ^)children[i];
359
				BaseForm ^childForm = (BaseForm ^)children[i];
865
				if ( !childForm->TabPage()->Visible )
360
				if ( !childForm->TabPage()->Visible )
866
				{
361
				{
867
					childForm->Show();
362
					childForm->Show();
868
					childForm->TabPage()->Show();
363
					childForm->TabPage()->Show();
869
				}
364
				}
870
			}
365
			}
871
		}
366
		}
872
 
367
 
873
		void OpenOptionsMenu()
368
		void OpenOptionsMenu()
874
		{
369
		{
875
			 Options ^opt = gcnew Options(this->imageListGames, m_pGameDir, m_pPackages, m_settings);
370
			 Options ^opt = gcnew Options(this->imageListGames, _pGameDir, m_pPackages, m_settings);
876
			 if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
371
			 if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
877
			 {
372
			 {
878
				 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
373
				 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
879
			 }
374
			 }
880
 
375
 
Line 883... Line 378...
883
		}
378
		}
884
 
379
 
885
		void OpenFiles(ArrayList ^list, bool checkExtension, bool display)
380
		void OpenFiles(ArrayList ^list, bool checkExtension, bool display)
886
		{
381
		{
887
			if ( !list )
382
			if ( !list )
888
				return;
383
				return;
889
 
384
 
890
			for ( int i = 0; i < list->Count; i++ )
385
			for ( int i = 0; i < list->Count; i++ )
891
				this->Open(cli::safe_cast<String ^>(list[i]), display, checkExtension);
386
				this->Open(cli::safe_cast<String ^>(list[i]), display, checkExtension);
892
 
387
 
893
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
388
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
894
			for ( int i = 0; i < children->Length; i++ )
389
			for ( int i = 0; i < children->Length; i++ )
Line 989... Line 484...
989
						}
484
						}
990
						MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
485
						MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
991
					}
486
					}
992
					else {
487
					else {
993
						MessageBox::Show(this, "Error: Unable to export to:\n" + SystemStringFromCyString(exportFilename), "Error Export", MessageBoxButtons::OK, MessageBoxIcon::Error);
488
						MessageBox::Show(this, "Error: Unable to export to:\n" + SystemStringFromCyString(exportFilename), "Error Export", MessageBoxButtons::OK, MessageBoxIcon::Error);
994
					}
489
					}
995
				}
490
				}
996
			}
491
			}
997
		}
492
		}
998
 
493
 
999
		void ExtractPackage(String ^file, bool here)
494
		void ExtractPackage(String ^file, bool here)
1000
		{
495
		{
1001
			CyString sFile = CyStringFromSystemString(file);
496
			CyString sFile = CyStringFromSystemString(file);
1002
			int error = 0;
497
			int error = 0;
1003
 
498
 
Line 1040... Line 535...
1040
							}
535
							}
1041
							MessageBox::Show(this, message, "Extracted Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
536
							MessageBox::Show(this, message, "Extracted Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
1042
						}
537
						}
1043
						else {
538
						else {
1044
							MessageBox::Show(this, "Error: Unable to extract to:\n" + to, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
539
							MessageBox::Show(this, "Error: Unable to extract to:\n" + to, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
1045
						}
540
						}
1046
					}
541
					}
1047
				}
542
				}
1048
			}
543
			}
1049
		}
544
		}
1050
 
545
 
1051
		void SavePackagerScript(String ^file)
546
		void SavePackagerScript(String ^file)
1052
		{
547
		{
Line 1095... Line 590...
1095
					MessageBox::Show(this, "Error: Unable to create package from script\n" + file, "Error Creating Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
590
					MessageBox::Show(this, "Error: Unable to create package from script\n" + file, "Error Creating Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
1096
			}
591
			}
1097
		}
592
		}
1098
 
593
 
1099
		void OpenPackagerScript(String ^file)
594
		void OpenPackagerScript(String ^file)
1100
		{
595
		{
1101
			CyStringList malformed, unknown;
596
			CyStringList malformed, unknown;
1102
			CBaseFile *package = m_pPackages->LoadPackagerScript(CyStringFromSystemString(file), SPKCOMPRESS_NONE, NULL, &malformed, &unknown);
597
			CBaseFile *package = m_pPackages->LoadPackagerScript(CyStringFromSystemString(file), SPKCOMPRESS_NONE, NULL, &malformed, &unknown);
1103
			if ( package )
598
			if ( package )
1104
			{
599
			{
1105
				package->SetDataCompression(SPKCOMPRESS_7ZIP);
600
				package->SetDataCompression(SPKCOMPRESS_7ZIP);
Line 1113... Line 608...
1113
			ofd->Filter = "Packager Script (*.sps)|*.sps";
608
			ofd->Filter = "Packager Script (*.sps)|*.sps";
1114
			ofd->FilterIndex = 1;
609
			ofd->FilterIndex = 1;
1115
			ofd->Title = "Select the packager script to create a package from";
610
			ofd->Title = "Select the packager script to create a package from";
1116
			ofd->RestoreDirectory = true;
611
			ofd->RestoreDirectory = true;
1117
			ofd->Multiselect = false;
612
			ofd->Multiselect = false;
1118
 
613
 
1119
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
614
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1120
				OpenPackagerScript(ofd->FileName);
615
				OpenPackagerScript(ofd->FileName);
1121
		}
616
		}
1122
 
617
 
1123
		MultiForm ^OpenPackage(bool display, CMultiSpkFile *package, String ^file, String ^title)
618
		MultiForm ^OpenPackage(bool display, CMultiSpkFile *package, String ^file, String ^title)
Line 1126... Line 621...
1126
			TabPage ^tp = gcnew TabPage();
621
			TabPage ^tp = gcnew TabPage();
1127
			tp->Text = title;
622
			tp->Text = title;
1128
			tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
623
			tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
1129
			if ( tp->ImageIndex == -1 )
624
			if ( tp->ImageIndex == -1 )
1130
				tp->ImageIndex = 0;
625
				tp->ImageIndex = 0;
1131
 
626
 
1132
			ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
627
			ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
1133
			MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
628
			MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1134
			
629
			
1135
			childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
630
			childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
1136
			this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
631
			this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
1137
			childForm->WindowState = FormWindowState::Minimized;
632
			childForm->WindowState = FormWindowState::Minimized;
1138
 
633
 
1139
			this->ProcessOpen(false, tp, childForm);
634
			this->ProcessOpen(false, tp, childForm);
1140
			childForm->LoadPackage(package, file);
635
			childForm->LoadPackage(package, file);
1141
			this->ProcessOpen(display, tp, childForm);
636
			this->ProcessOpen(display, tp, childForm);
1142
 
637
 
1143
			return childForm;
638
			return childForm;
1144
		}
639
		}
1145
		PackageForm ^OpenPackage(bool display, CBaseFile *package, String ^file, String ^title)
640
		PackageForm ^OpenPackage(bool display, CBaseFile *package, String ^file, String ^title)
1146
		{
641
		{
Line 1208... Line 703...
1208
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
703
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
1209
			fbd->Description = "Select the path to generate the updates from";
704
			fbd->Description = "Select the path to generate the updates from";
1210
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
705
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1211
			{
706
			{
1212
				int count = 0;
707
				int count = 0;
1213
				for ( int type = 0; type < 2; type++ )
708
				for ( int type = 0; type < 2; type++ )
1214
				{
709
				{
1215
					array <System::String ^> ^Files = nullptr;
710
					array <System::String ^> ^Files = nullptr;
1216
					if ( type == 0 )
711
					if ( type == 0 )
1217
						Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
712
						Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
1218
					else if ( type == 1 )
713
					else if ( type == 1 )
Line 1279... Line 774...
1279
					CFileIO File(CyStringFromSystemString(fbd->SelectedPath) + "/xpackagedata.dat");
774
					CFileIO File(CyStringFromSystemString(fbd->SelectedPath) + "/xpackagedata.dat");
1280
					if ( File.WriteFile(&filedata) )
775
					if ( File.WriteFile(&filedata) )
1281
						MessageBox::Show(this, "Data file generated for " + filedata.Count() + " packages\nDirectory: " + fbd->SelectedPath, "Web File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
776
						MessageBox::Show(this, "Data file generated for " + filedata.Count() + " packages\nDirectory: " + fbd->SelectedPath, "Web File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
1282
					else
777
					else
1283
						MessageBox::Show(this, "Unable to write web data file in " + fbd->SelectedPath, "File Write Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
778
						MessageBox::Show(this, "Unable to write web data file in " + fbd->SelectedPath, "File Write Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1284
				}
779
				}
1285
			}
780
			}
1286
		}
781
		}
1287
 
782
 
1288
		void Open(System::String ^file, bool display, bool checkExtension)
783
		void Open(System::String ^file, bool display, bool checkExtension)
1289
		{
784
		{
1290
			CBaseFile *convertFile = NULL;
785
			CBaseFile *convertFile = NULL;
1291
			if ( checkExtension )
786
			if ( checkExtension )
1292
			{
787
			{
1293
				if ( String::Compare(IO::FileInfo(file).Extension, ".spk") != 0 && String::Compare(IO::FileInfo(file).Extension, ".xsp") != 0 && String::Compare(IO::FileInfo(file).Extension, ".sps") != 0 )
788
				if ( String::Compare(IO::FileInfo(file).Extension, ".spk") != 0 && String::Compare(IO::FileInfo(file).Extension, ".xsp") != 0 && String::Compare(IO::FileInfo(file).Extension, ".sps") != 0 )
1294
					return;
789
					return;
1295
			}
790
			}
1296
 
791
 
1297
			if ( !System::IO::File::Exists(file) )
792
			if ( !System::IO::File::Exists(file) )
1298
			{
793
			{
1299
				if ( display )
794
				if ( display )
1300
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nFile doesn't exist", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
795
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nFile doesn't exist", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1301
				return;
796
				return;
1302
			}
797
			}
1303
 
798
 
1304
			// check if its already open
799
			// check if its already open
1305
			if ( this->IsOpen(file) )
800
			if ( this->IsOpen(file) )
1306
			{
801
			{
Line 1349... Line 844...
1349
					if ( spkFile ) {
844
					if ( spkFile ) {
1350
						loaded = true;
845
						loaded = true;
1351
						spkFile->adjustChanged(true);
846
						spkFile->adjustChanged(true);
1352
						spkFile->setFilename(_S(file));
847
						spkFile->setFilename(_S(file));
1353
						convertFile = spkFile;
848
						convertFile = spkFile;
1354
					}
849
					}
1355
				}
850
				}
1356
 
851
 
1357
				if ( !loaded )
852
				if ( !loaded )
1358
				{
853
				{
1359
					if ( display )
854
					if ( display )
1360
						MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
855
						MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1361
					return;				
856
					return;				
1362
				}
857
				}
1363
			}
858
			}
1364
 
859
 
1365
			// open multi package
860
			// open multi package
1366
			bool loaded = false;
861
			bool loaded = false;
1367
 
862
 
1368
			int error;
863
			int error;
1369
			if ( fileType == SPKFILE_MULTI )
864
			if ( fileType == SPKFILE_MULTI )
1370
			{
865
			{
1371
				CMultiSpkFile *mspk = m_pPackages->OpenMultiPackage(sFile, &error);
866
				CMultiSpkFile *mspk = m_pPackages->OpenMultiPackage(sFile, &error);
1372
				if ( mspk )
867
				if ( mspk )
1373
				{
868
				{
1374
					loaded = true;
869
					loaded = true;
1375
					BaseForm ^childForm = this->OpenPackage(display, mspk, file, "");
870
					BaseForm ^childForm = this->OpenPackage(display, mspk, file, "");
1376
					childForm->Text = file;
871
					childForm->Text = file;
1377
				}
872
				}
1378
			}
873
			}
Line 1422... Line 917...
1422
							sError = "Invalid Package File";
917
							sError = "Invalid Package File";
1423
							break;
918
							break;
1424
						case INSTALLERR_NOMULTI:
919
						case INSTALLERR_NOMULTI:
1425
							sError = "Multi-Packages not currently supported";
920
							sError = "Multi-Packages not currently supported";
1426
							break;
921
							break;
1427
					}
922
					}
1428
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
923
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1429
				}
924
				}
1430
			}
925
			}
1431
		}
926
		}
1432
 
927
 
Line 1661... Line 1156...
1661
			if ( this->WindowState == FormWindowState::Maximized )
1156
			if ( this->WindowState == FormWindowState::Maximized )
1662
				lines.PushBack("CreatorMax:");
1157
				lines.PushBack("CreatorMax:");
1663
 
1158
 
1664
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1159
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1665
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
1160
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
1666
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
1161
			_pGameDir->writeData(&lines);
1667
				lines.PushBack(CyString("GameDir:") + gd->dir + ";" + CyString::Number(gd->iGame) + " " + gd->name + ((gd->bLoad) ? ";1" : ";0"));
-
 
1668
			if ( m_settings->bGenerateUpdate )
1162
			if ( m_settings->bGenerateUpdate )
1669
				lines.PushBack("GenerateUpdate:");
1163
				lines.PushBack("GenerateUpdate:");
1670
 
1164
 
1671
			Config.WriteFile(&lines);
1165
			Config.WriteFile(&lines);
1672
		}
1166
		}
Line 1697... Line 1191...
1697
						else if ( start.Compare("CreatorMax") )
1191
						else if ( start.Compare("CreatorMax") )
1698
							this->WindowState = FormWindowState::Maximized;
1192
							this->WindowState = FormWindowState::Maximized;
1699
						else if ( start.Compare("GenerateUpdate") )
1193
						else if ( start.Compare("GenerateUpdate") )
1700
							m_settings->bGenerateUpdate = true;
1194
							m_settings->bGenerateUpdate = true;
1701
						else if ( start.Compare("GameDir") )
1195
						else if ( start.Compare("GameDir") )
1702
						{
-
 
1703
							SGameDir *gd = new SGameDir;
-
 
1704
							gd->dir = rest.GetToken(";", 1, 1).ToString();
-
 
1705
							gd->name = rest.GetToken(";", 2, 2).ToString();
-
 
1706
							gd->iGame = gd->name.token(" ", 1).toLong();
-
 
1707
							gd->name = gd->name.tokens(" ", 2);
-
 
1708
 
-
 
1709
							SGameExe *exe = m_pPackages->GetGameExe()->GetGame(gd->iGame);
-
 
1710
 
-
 
1711
							gd->bLoad = rest.GetToken(";", 3, 3).ToBool();
-
 
1712
							gd->pVfs = new CVirtualFileSystem();
-
 
1713
							gd->pVfs->setLanguage(44);
-
 
1714
							gd->pVfs->LoadFilesystem(gd->dir);
-
 
1715
							if ( exe ) {
-
 
1716
								gd->pVfs->SetAddon(exe->sAddon);
-
 
1717
							}
-
 
1718
							m_pGameDir->push_back(gd);
1196
							_pGameDir->parse(rest.ToString(), m_pPackages);
1719
						}
-
 
1720
					}
1197
					}
1721
 
1198
 
1722
					delete lines;
1199
					delete lines;
1723
				}
1200
				}
1724
			}
1201
			}
1725
		}
1202
		}
1726
 
1203
 
1727
 
1204
 
1728
		void LoadText(bool center, bool reload)
1205
		void LoadText(bool center, bool reload)
1729
		{
1206
		{
1730
			if ( m_bTextLoaded && !reload )
1207
			if ( m_bTextLoaded && !reload )
1731
				return;
1208
				return;
1732
			m_bTextLoaded = true;
1209
			m_bTextLoaded = true;
1733
 
1210
 
1734
			if ( m_pGameDir->empty() )
1211
			if ( _pGameDir->isEmpty() ) return;
1735
				return;
-
 
1736
 
1212
 
1737
			Creator::LoadText ^load = gcnew Creator::LoadText(m_pGameDir, m_pPackages);
1213
			Creator::LoadText ^load = gcnew Creator::LoadText(_pGameDir, m_pPackages);
1738
			if ( center )
1214
			if ( center )
1739
				load->StartPosition = Windows::Forms::FormStartPosition::CenterScreen;
1215
				load->StartPosition = Windows::Forms::FormStartPosition::CenterScreen;
1740
			
1216
			
1741
			load->ShowDialog(this);
1217
			load->ShowDialog(this);
1742
		}
1218
		}