Subversion Repositories spk

Rev

Rev 321 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 321 Rev 341
Line 125... Line 125...
125
	wprintf(L"\t-verifyscript <packagescript>\n\t\tChecks a packager script is valid without creating the resulting file\n\n");
125
	wprintf(L"\t-verifyscript <packagescript>\n\t\tChecks a packager script is valid without creating the resulting file\n\n");
126
	wprintf(L"\t-generatescript <package> [packagescript]\n\t\tCreates a packager script (.sps) from a spk file\n\n");
126
	wprintf(L"\t-generatescript <package> [packagescript]\n\t\tCreates a packager script (.sps) from a spk file\n\n");
127
	wprintf(L"\t-extractship <modfile> <xspfile> [shipid]\n\t\tCreates an XSP ship file from a mod package\n\n");
127
	wprintf(L"\t-extractship <modfile> <xspfile> [shipid]\n\t\tCreates an XSP ship file from a mod package\n\n");
128
	wprintf(L"\t-generateupdatefile <package>\n\t\tCreates an update file for the spk/xsp file\n\n");
128
	wprintf(L"\t-generateupdatefile <package>\n\t\tCreates an update file for the spk/xsp file\n\n");
129
	wprintf(L"\t-packagelist <filenames>\n\t\tThis will generate the update file to allow downloading packages from a server.\n\n");
129
	wprintf(L"\t-packagelist <filenames>\n\t\tThis will generate the update file to allow downloading packages from a server.\n\n");
130
	//	printf ( "\t-convertxspwizard <oldxsp> [newxsp]\n\t\tConverts an old XSP file into the new format\n\n");
130
	//	wprintf(L"\t-convertxspwizard <oldxsp> [newxsp]\n\t\tConverts an old XSP file into the new format\n\n");
131
}
131
}
132
 
132
 
133
void Settings(const Utils::CommandLine &cmd)
133
void Settings(const Utils::CommandLine &cmd)
134
{
134
{
135
	const Utils::WString &settings = cmd.arg(2);
135
	const Utils::WString &settings = cmd.arg(2);
Line 174... Line 174...
174
			spkfile.setAuthor(cmd.arg(3));
174
			spkfile.setAuthor(cmd.arg(3));
175
			wprintf(L"Settings Author to: %s\n", spkfile.author().c_str());
175
			wprintf(L"Settings Author to: %s\n", spkfile.author().c_str());
176
		}
176
		}
177
 
177
 
178
		spkfile.writeFile(filename);
178
		spkfile.writeFile(filename);
179
		printf ( "\nSPK file has been written sucessfully\n" );
179
		wprintf(L"\nSPK file has been written sucessfully\n" );
180
	}
180
	}
181
	else
181
	else
182
		wprintf(L"File, %s, is not a valid SPK file\n", filename.c_str() );
182
		wprintf(L"File, %s, is not a valid SPK file\n", filename.c_str() );
183
}
183
}
184
 
184
 
Line 225... Line 225...
225
 
225
 
226
Utils::WString GetTerranConflictDir()
226
Utils::WString GetTerranConflictDir()
227
{
227
{
228
	while ( true )
228
	while ( true )
229
	{
229
	{
230
		printf ( "\nPlease enter the directory for terran conflict: ");
230
		wprintf(L"\nPlease enter the directory for terran conflict: ");
231
		Utils::WString dir = GetInput();
231
		Utils::WString dir = GetInput();
232
		if ( dir.empty() )
232
		if ( dir.empty() )
233
			return Utils::WString::Null();
233
			return Utils::WString::Null();
234
 
234
 
235
		// check if the directory exists
235
		// check if the directory exists
Line 262... Line 262...
262
		{
262
		{
263
			wprintf(L"[ERROR]\n\nFailed to convert old xsp file, %s\n", filename.c_str() );
263
			wprintf(L"[ERROR]\n\nFailed to convert old xsp file, %s\n", filename.c_str() );
264
			return;
264
			return;
265
		}
265
		}
266
 
266
 
267
		printf ( "[DONE]\n");
267
		wprintf(L"[DONE]\n");
268
 
268
 
269
		Utils::WString dir;
269
		Utils::WString dir;
270
		printf ("Do you want to create weapon masks for Terran conflict? ");
270
		wprintf(L"Do you want to create weapon masks for Terran conflict? ");
271
		Utils::WString input = GetInput();
271
		Utils::WString input = GetInput();
272
		if ( input.Compare(L"y") || input.Compare(L"yes") )
272
		if ( input.Compare(L"y") || input.Compare(L"yes") )
273
		{
273
		{
274
			dir = GetTerranConflictDir();
274
			dir = GetTerranConflictDir();
275
			if (!dir.empty())
275
			if (!dir.empty())
Line 331... Line 331...
331
			}
331
			}
332
			++id;
332
			++id;
333
		}
333
		}
334
		if ( i == 1 )
334
		if ( i == 1 )
335
			wprintf(L"[%3d][%30s]\n", id, ids[0].c_str());
335
			wprintf(L"[%3d][%30s]\n", id, ids[0].c_str());
336
		printf("Enter ID to use > ");
336
		wprintf(L"Enter ID to use > ");
337
		shipid = GetInput();
337
		shipid = GetInput();
338
 
338
 
339
		if ( shipid.isNumber() )
339
		if ( shipid.isNumber() )
340
			tShipsLine = ships->get(shipid.toInt())->str;
340
			tShipsLine = ships->get(shipid.toInt())->str;
341
		else
341
		else
Line 355... Line 355...
355
	wprintf(L"Extracting ship from %s, Ship=%s\n", catfile.c_str(), tShipsLine.token(L";", -2).c_str());
355
	wprintf(L"Extracting ship from %s, Ship=%s\n", catfile.c_str(), tShipsLine.token(L";", -2).c_str());
356
 
356
 
357
	CXspFile ship;
357
	CXspFile ship;
358
	if ( ship.extractShip(pVfs, tShipsLine.token(L";", -2).toString(), 0))
358
	if ( ship.extractShip(pVfs, tShipsLine.token(L";", -2).toString(), 0))
359
	{
359
	{
360
		printf ( "Ship has been successfully extracted\n" );
360
		wprintf(L"Ship has been successfully extracted\n" );
361
 
361
 
362
		wprintf(L"\t- Models:\t %lu\n", static_cast<unsigned long>(ship.countFiles(FILETYPE_SHIPMODEL)));
362
		wprintf(L"\t- Models:\t %lu\n", static_cast<unsigned long>(ship.countFiles(FILETYPE_SHIPMODEL)));
363
		wprintf(L"\t- Textures:\t %lu\n", static_cast<unsigned long>(ship.countFiles(FILETYPE_SHIPOTHER)));
363
		wprintf(L"\t- Textures:\t %lu\n", static_cast<unsigned long>(ship.countFiles(FILETYPE_SHIPOTHER)));
364
		printf("\t- Dummies:\t %d\n", ship.GetDummies()->size());
364
		wprintf(L"\t- Dummies:\t %d\n", ship.GetDummies()->size());
365
		printf("\t- Components:\t %d\n", ship.GetComponents()->size());
365
		wprintf(L"\t- Components:\t %d\n", ship.GetComponents()->size());
366
		wprintf(L"\t- Bodies:\t %lu\n", static_cast<unsigned long>(ship.getBodies().size()));
366
		wprintf(L"\t- Bodies:\t %lu\n", static_cast<unsigned long>(ship.getBodies().size()));
367
		printf("\t- Cockpits:\t %d\n", ship.GetCockpits()->size());
367
		wprintf(L"\t- Cockpits:\t %d\n", ship.GetCockpits()->size());
368
		printf("\t- Text Entries:\t %d\n", ship.GetTexts()->size());
368
		wprintf(L"\t- Text Entries:\t %d\n", ship.GetTexts()->size());
369
 
369
 
370
		printf("\nEnter the name for the ship: ");
370
		wprintf(L"\nEnter the name for the ship: ");
371
		ship.setName(GetInput().toString());
371
		ship.setName(GetInput().toString());
372
		printf("Enter the author for the ship: ");
372
		wprintf(L"Enter the author for the ship: ");
373
		ship.setAuthor(GetInput().toString());
373
		ship.setAuthor(GetInput().toString());
374
		printf("Enter the version for the ship: V");
374
		wprintf(L"Enter the version for the ship: V");
375
		ship.setVersion(GetInput().toString());
375
		ship.setVersion(GetInput().toString());
376
		printf("Enter the description for the ship: ");
376
		wprintf(L"Enter the description for the ship: ");
377
		ship.setDescription(GetInput().toString());
377
		ship.setDescription(GetInput().toString());
378
 
378
 
379
		struct tm   *currDate;
379
		struct tm   *currDate;
380
		char    dateString[100];
380
		char    dateString[100];
381
		time_t now = time(NULL);
381
		time_t now = time(NULL);
Line 501... Line 501...
501
		else
501
		else
502
			wprintf(L"%s Author: %s\n", sType.c_str(), pBaseFile->author().c_str() );
502
			wprintf(L"%s Author: %s\n", sType.c_str(), pBaseFile->author().c_str() );
503
		if ( !pBaseFile->version().empty() ) wprintf(L"%s Version: %s\n", sType.c_str(), pBaseFile->version().c_str() );
503
		if ( !pBaseFile->version().empty() ) wprintf(L"%s Version: %s\n", sType.c_str(), pBaseFile->version().c_str() );
504
 
504
 
505
		//for game
505
		//for game
506
		printf("For Games: ");
506
		wprintf(L"For Games: ");
507
		if ( !pBaseFile->AnyGameCompatability() )
507
		if ( !pBaseFile->AnyGameCompatability() )
508
			printf("All");
508
			wprintf(L"All");
509
		else
509
		else
510
			wprintf(L"%s", cmd.packages().getGameTypesString(pBaseFile, true).c_str());
510
			wprintf(L"%s", cmd.packages().getGameTypesString(pBaseFile, true).c_str());
511
		printf("\n");
511
		wprintf(L"\n");
512
 
512
 
513
		if ( pXspFile )
513
		if ( pXspFile )
514
		{
514
		{
515
			wprintf(L"Ship Display Name: %s\n", pXspFile->shipName(44).c_str());
515
			wprintf(L"Ship Display Name: %s\n", pXspFile->shipName(44).c_str());
516
			if ( pXspFile->IsExistingShip() )
516
			if ( pXspFile->IsExistingShip() )
Line 518... Line 518...
518
			else
518
			else
519
				wprintf(L"Ship ID: %s\n", pXspFile->shipID().c_str() );
519
				wprintf(L"Ship ID: %s\n", pXspFile->shipID().c_str() );
520
 
520
 
521
			if ( pXspFile->anyShipyards() )
521
			if ( pXspFile->anyShipyards() )
522
			{
522
			{
523
				printf ( "Add To Shipyards:\n" );
523
				wprintf(L"Add To Shipyards:\n" );
524
				for (unsigned long i = 1; i <= GetMaxShipyards(); i *= 2 )
524
				for (unsigned long i = 1; i <= GetMaxShipyards(); i *= 2 )
525
				{
525
				{
526
					if ( pXspFile->isShipyard(static_cast<ShipyardRace>(i)) )
526
					if ( pXspFile->isShipyard(static_cast<ShipyardRace>(i)) )
527
						wprintf(L"\t%s\n", GetShipyardName(static_cast<ShipyardRace>(i)).c_str());
527
						wprintf(L"\t%s\n", GetShipyardName(static_cast<ShipyardRace>(i)).c_str());
528
				}
528
				}
Line 577... Line 577...
577
		if ( !pBaseFile->creationDate().empty() ) wprintf(L"Creation Date: %s\n", pBaseFile->creationDate().c_str() );
577
		if ( !pBaseFile->creationDate().empty() ) wprintf(L"Creation Date: %s\n", pBaseFile->creationDate().c_str() );
578
		if ( !pBaseFile->description().empty() ) wprintf(L"Description: %s\n", pBaseFile->description().c_str() );
578
		if ( !pBaseFile->description().empty() ) wprintf(L"Description: %s\n", pBaseFile->description().c_str() );
579
		if ( pSpkFile )
579
		if ( pSpkFile )
580
		{
580
		{
581
			if ( pSpkFile->IsLibrary() )
581
			if ( pSpkFile->IsLibrary() )
582
				printf ( "Script Type: Library\n" );
582
				wprintf(L"Script Type: Library\n" );
583
			else if ( pSpkFile->IsPatch() )
583
			else if ( pSpkFile->IsPatch() )
584
				printf ( "Script Type: Patch Mod\n" );
584
				wprintf(L"Script Type: Patch Mod\n" );
585
			else if ( pSpkFile->IsCustomStart() )
585
			else if ( pSpkFile->IsCustomStart() )
586
				printf ( "Script Type: Custom Start\n" );
586
				wprintf(L"Script Type: Custom Start\n" );
587
			else if ( pSpkFile->IsPackageUpdate() )
587
			else if ( pSpkFile->IsPackageUpdate() )
588
				printf ( "Script Type: Package Update\n" );
588
				wprintf(L"Script Type: Package Update\n" );
589
			else if ( !pSpkFile->scriptTypeString(44).empty() )
589
			else if ( !pSpkFile->scriptTypeString(44).empty() )
590
				wprintf(L"Script Type: %s\n", pSpkFile->scriptTypeString(44).c_str() );
590
				wprintf(L"Script Type: %s\n", pSpkFile->scriptTypeString(44).c_str() );
591
 
591
 
592
			if ( !pSpkFile->GetWaresList()->empty() )
592
			if ( !pSpkFile->GetWaresList()->empty() )
593
			{
593
			{
Line 605... Line 605...
605
		if ( !pBaseFile->webSite().empty() )	wprintf(L"Web Site Address: %s\n", pBaseFile->webSite().c_str() );
605
		if ( !pBaseFile->webSite().empty() )	wprintf(L"Web Site Address: %s\n", pBaseFile->webSite().c_str() );
606
		if ( !pBaseFile->webAddress().empty() ) wprintf(L"Update Address: %s\n", pBaseFile->webAddress().c_str() );
606
		if ( !pBaseFile->webAddress().empty() ) wprintf(L"Update Address: %s\n", pBaseFile->webAddress().c_str() );
607
 
607
 
608
		if ( pBaseFile->anyWebMirrors() )
608
		if ( pBaseFile->anyWebMirrors() )
609
		{
609
		{
610
			printf("Update Mirror Addresses:\n");
610
			wprintf(L"Update Mirror Addresses:\n");
611
			for (size_t i = 0; i < pBaseFile->getMaxWebMirrors(); i++ )
611
			for (size_t i = 0; i < pBaseFile->getMaxWebMirrors(); i++ )
612
				wprintf(L"\t%s\n", pBaseFile->getWebMirror(i).c_str());
612
				wprintf(L"\t%s\n", pBaseFile->getWebMirror(i).c_str());
613
		}
613
		}
614
		if ( pSpkFile )
614
		if ( pSpkFile )
615
		{
615
		{
Line 617... Line 617...
617
				wprintf(L"Script is a child to the mod: %s by %s\n", pSpkFile->otherName().c_str(), pSpkFile->otherAuthor().c_str() );
617
				wprintf(L"Script is a child to the mod: %s by %s\n", pSpkFile->otherName().c_str(), pSpkFile->otherAuthor().c_str() );
618
		}
618
		}
619
 
619
 
620
		if ( pBaseFile->AnyDependacies() )
620
		if ( pBaseFile->AnyDependacies() )
621
		{
621
		{
622
			printf ( "Required Dependacies:\n" );
622
			wprintf(L"Required Dependacies:\n" );
623
			for ( SNeededLibrary *needed = pBaseFile->GetNeededLibraries()->First(); needed; needed = pBaseFile->GetNeededLibraries()->Next() )
623
			for ( SNeededLibrary *needed = pBaseFile->GetNeededLibraries()->First(); needed; needed = pBaseFile->GetNeededLibraries()->Next() )
624
				wprintf(L"\t%s by %s (Minimum Version=%s)\n", needed->sName.c_str(), needed->sAuthor.c_str(), needed->sMinVersion.c_str() );
624
				wprintf(L"\t%s by %s (Minimum Version=%s)\n", needed->sName.c_str(), needed->sAuthor.c_str(), needed->sMinVersion.c_str() );
625
		}
625
		}
626
		if ( pBaseFile->easeOfUse() != -1 ) printf ( "Ease Of Use Rating: %d\n", pBaseFile->easeOfUse() );
626
		if ( pBaseFile->easeOfUse() != -1 ) wprintf(L"Ease Of Use Rating: %d\n", pBaseFile->easeOfUse() );
627
		if ( pBaseFile->gameChanging() != -1 ) printf ( "Game Changing Rating: %d\n", pBaseFile->gameChanging() );
627
		if ( pBaseFile->gameChanging() != -1 ) wprintf(L"Game Changing Rating: %d\n", pBaseFile->gameChanging() );
628
		if ( pBaseFile->recommended() != -1 ) printf ( "Recommendation Rating: %d\n", pBaseFile->recommended() );
628
		if ( pBaseFile->recommended() != -1 ) wprintf(L"Recommendation Rating: %d\n", pBaseFile->recommended() );
629
		if (pBaseFile->icon())
629
		if (pBaseFile->icon())
630
			wprintf(L"Icon File Found, Type: %s, Size: %s\n", pBaseFile->iconExt().c_str(), pBaseFile->icon()->dataSizeString().c_str() );
630
			wprintf(L"Icon File Found, Type: %s, Size: %s\n", pBaseFile->iconExt().c_str(), pBaseFile->icon()->dataSizeString().c_str() );
631
 
631
 
632
		if ( pBaseFile->GetFileList()->size() )
632
		if ( pBaseFile->GetFileList()->size() )
633
		{
633
		{
634
			printf("\nListing files in package:\n");
634
			wprintf(L"\nListing files in package:\n");
635
			CLinkList<C_File> *list = pBaseFile->GetFileList();
635
			CLinkList<C_File> *list = pBaseFile->GetFileList();
636
 
636
 
637
			for (unsigned int game = 0; game < 31; ++game)
637
			for (unsigned int game = 0; game < 31; ++game)
638
			{
638
			{
639
				bool heading = true;
639
				bool heading = true;
Line 659... Line 659...
659
				}
659
				}
660
			}
660
			}
661
 
661
 
662
		}
662
		}
663
		else
663
		else
664
			printf ( "\nThere are currently no files in the package\n" );
664
			wprintf(L"\nThere are currently no files in the package\n" );
665
	}
665
	}
666
	else if ( check == SPKFILE_MULTI )
666
	else if ( check == SPKFILE_MULTI )
667
	{
667
	{
668
		CMultiSpkFile spkfile;
668
		CMultiSpkFile spkfile;
669
		wprintf(L"* Opening Multi-SPK file, %s...\n", filename.c_str() );
669
		wprintf(L"* Opening Multi-SPK file, %s...\n", filename.c_str() );
Line 1235... Line 1235...
1235
}
1235
}
1236
 
1236
 
1237
void GenerateUpdateList(const Utils::CommandLine &cmd)
1237
void GenerateUpdateList(const Utils::CommandLine &cmd)
1238
{
1238
{
1239
	Utils::WStringList list;
1239
	Utils::WStringList list;
1240
	for (int i = 1; i < cmd.argCount(); ++i)
1240
	for (size_t i = 1; i < cmd.argCount(); ++i)
1241
	{
1241
	{
1242
		Utils::WString file(cmd.arg(i));
1242
		Utils::WString file(cmd.arg(i));
1243
		if (CFileIO::Exists(file))
1243
		if (CFileIO::Exists(file))
1244
			list.pushBack(file, L"file");
1244
			list.pushBack(file, L"file");
1245
		else if (CFileIO::Exists(cmd.dirIO().file(file)))
1245
		else if (CFileIO::Exists(cmd.dirIO().file(file)))
Line 1309... Line 1309...
1309
 
1309
 
1310
				int error = 0;
1310
				int error = 0;
1311
				CBaseFile *p = cmd.packages().openPackage((*itr)->str.toString(), &error, 0, SPKREAD_NODATA);
1311
				CBaseFile *p = cmd.packages().openPackage((*itr)->str.toString(), &error, 0, SPKREAD_NODATA);
1312
				if (!p)
1312
				if (!p)
1313
				{
1313
				{
1314
					printf("\tERROR!\n");
1314
					wprintf(L"\tERROR!\n");
1315
					continue;
1315
					continue;
1316
				}
1316
				}
1317
				wprintf(L"\tData extracted: %s %s by %s\n", p->name().c_str(), p->version().c_str(), p->author().c_str());
1317
				wprintf(L"\tData extracted: %s %s by %s\n", p->name().c_str(), p->version().c_str(), p->author().c_str());
1318
				if (!p->creationDate().empty())
1318
				if (!p->creationDate().empty())
1319
					wprintf(L"\t\tCreated: %s\n", p->creationDate().c_str());
1319
					wprintf(L"\t\tCreated: %s\n", p->creationDate().c_str());
Line 1477... Line 1477...
1477
	variables.pushBack(L"$PATH", curDir);
1477
	variables.pushBack(L"$PATH", curDir);
1478
 
1478
 
1479
	CFileProgress info(&p, NULL, "Added File");
1479
	CFileProgress info(&p, NULL, "Added File");
1480
	CBaseFile *package = p.loadPackagerScript(filename, -1, (verify) ? NULL : &GetAsk, &malformed, &unknown, &variables, &info);
1480
	CBaseFile *package = p.loadPackagerScript(filename, -1, (verify) ? NULL : &GetAsk, &malformed, &unknown, &variables, &info);
1481
 
1481
 
1482
	printf("\n");
1482
	wprintf(L"\n");
1483
 
1483
 
1484
	if ( verify )
1484
	if ( verify )
1485
	{
1485
	{
1486
		if ( !malformed.empty() )
1486
		if ( !malformed.empty() )
1487
		{
1487
		{
1488
			printf("Malformed Lines (%lu):\n", static_cast<unsigned long>(malformed.size()));
1488
			wprintf(L"Malformed Lines (%lu):\n", static_cast<unsigned long>(malformed.size()));
1489
			for(auto itr = malformed.begin(); itr != malformed.end(); itr++)				
1489
			for(auto itr = malformed.begin(); itr != malformed.end(); itr++)				
1490
				wprintf(L"\t(Line %3d) %s\n", (*itr)->data.toInt(), (*itr)->str.c_str());
1490
				wprintf(L"\t(Line %3d) %s\n", (*itr)->data.toInt(), (*itr)->str.c_str());
1491
		}
1491
		}
1492
		if ( !unknown.empty() )
1492
		if ( !unknown.empty() )
1493
		{
1493
		{
1494
			printf("Unknown Commands (%lu):\n", static_cast<unsigned long>(unknown.size()));
1494
			wprintf(L"Unknown Commands (%lu):\n", static_cast<unsigned long>(unknown.size()));
1495
			for (auto itr = unknown.begin(); itr != unknown.end(); itr++)
1495
			for (auto itr = unknown.begin(); itr != unknown.end(); itr++)
1496
				wprintf(L"\t* Command: %s = %s\n", (*itr)->str.c_str(), (*itr)->data.c_str());
1496
				wprintf(L"\t* Command: %s = %s\n", (*itr)->str.c_str(), (*itr)->data.c_str());
1497
		}
1497
		}
1498
	}
1498
	}
1499
 
1499
 
1500
	if ( !package )
1500
	if ( !package )
1501
	{
1501
	{
1502
		if ( verify )
1502
		if ( verify )
1503
			printf("Error: There are errors in the packager script which prevents it from being created\n");
1503
			wprintf(L"Error: There are errors in the packager script which prevents it from being created\n");
1504
		else
1504
		else
1505
			wprintf(L"Error: Unable to create package, from script: %s\n", filename.c_str());
1505
			wprintf(L"Error: Unable to create package, from script: %s\n", filename.c_str());
1506
	}
1506
	}
1507
	else
1507
	else
1508
	{
1508
	{
Line 1515... Line 1515...
1515
			saveto += L".spk";
1515
			saveto += L".spk";
1516
		else if ( !saveto.right(4).Compare(L".xsp") && package->GetType() == TYPE_XSP )
1516
		else if ( !saveto.right(4).Compare(L".xsp") && package->GetType() == TYPE_XSP )
1517
			saveto += L".xsp";
1517
			saveto += L".xsp";
1518
		wprintf(L"Saving file to: %s\n", CFileIO(saveto).fullFilename().c_str());
1518
		wprintf(L"Saving file to: %s\n", CFileIO(saveto).fullFilename().c_str());
1519
		if ( verify )
1519
		if ( verify )
1520
			printf("Package can be created from this script\n");
1520
			wprintf(L"Package can be created from this script\n");
1521
		else
1521
		else
1522
		{
1522
		{
1523
			// write script
1523
			// write script
1524
			if ( package->writeFile(saveto.toString()) )
1524
			if ( package->writeFile(saveto.toString()) )
1525
			{
1525
			{
1526
				if ( package->AutoGenerateUpdateFile() )
1526
				if ( package->AutoGenerateUpdateFile() )
1527
					package->createUpdateFile(CFileIO(saveto).dir());
1527
					package->createUpdateFile(CFileIO(saveto).dir());
1528
				wprintf(L"Package: %s was created\n", saveto.c_str());
1528
				wprintf(L"Package: %s was created\n", saveto.c_str());
1529
			}
1529
			}
1530
			else
1530
			else
1531
				printf("Error! There was a problem writing the package\n");
1531
				wprintf(L"Error! There was a problem writing the package\n");
1532
		}
1532
		}
1533
 
1533
 
1534
		saveto = package->exportFilename();
1534
		saveto = package->exportFilename();
1535
		if ( !saveto.empty() ) {
1535
		if ( !saveto.empty() ) {
1536
			saveto = saveto.findReplace(L"$DEFAULTDIR", curDir + L"/");
1536
			saveto = saveto.findReplace(L"$DEFAULTDIR", curDir + L"/");
1537
			saveto = saveto.findReplace(L"$PATH", curDir);
1537
			saveto = saveto.findReplace(L"$PATH", curDir);
1538
			saveto = saveto.findReplace(L"\\", L"/");
1538
			saveto = saveto.findReplace(L"\\", L"/");
1539
			saveto = saveto.findReplace(L"//", L"/");
1539
			saveto = saveto.findReplace(L"//", L"/");
1540
			wprintf(L"Exporting file to: %s\n", CFileIO(saveto).fullFilename().c_str());
1540
			wprintf(L"Exporting file to: %s\n", CFileIO(saveto).fullFilename().c_str());
1541
			if ( verify )
1541
			if ( verify )
1542
				printf("Package can be exported from this script\n");
1542
				wprintf(L"Package can be exported from this script\n");
1543
			else
1543
			else
1544
			{
1544
			{
1545
				// export
1545
				// export
1546
				if ( package->saveToArchive(saveto.toString(), 0, p.GetGameExe())) {
1546
				if ( package->saveToArchive(saveto.toString(), 0, p.GetGameExe())) {
1547
					if ( package->IsAnyGameInPackage() ) {
1547
					if ( package->IsAnyGameInPackage() ) {
Line 1553... Line 1553...
1553
						}
1553
						}
1554
					}
1554
					}
1555
					wprintf(L"Package: %s was exported\n", saveto.c_str());
1555
					wprintf(L"Package: %s was exported\n", saveto.c_str());
1556
				}
1556
				}
1557
				else
1557
				else
1558
					printf("Error! There was a problem exporting the package\n");
1558
					wprintf(L"Error! There was a problem exporting the package\n");
1559
			}
1559
			}
1560
		}
1560
		}
1561
	}
1561
	}
1562
}
1562
}
1563
 
1563
 
Line 1585... Line 1585...
1585
	Main entry point to program
1585
	Main entry point to program
1586
*/
1586
*/
1587
int main ( int argc, char **argv )
1587
int main ( int argc, char **argv )
1588
{
1588
{
1589
	// display program header to command prompt
1589
	// display program header to command prompt
1590
	printf ( "\nSPKTool V1.51 (SPK File Version %.2f) 17/05/2025 Created by Cycrow\n\n", (float)FILEVERSION );
1590
	wprintf(L"\nSPKTool V1.51 (SPK File Version %.2f) 17/05/2025 Created by Cycrow\n\n", (float)FILEVERSION );
1591
 
1591
 
1592
	Utils::CommandLine cmd(argc, argv);
1592
	Utils::CommandLine cmd(argc, argv);
1593
	g_dir = cmd.cmdDir();
1593
	g_dir = cmd.cmdDir();
1594
	g_read = false;
1594
	g_read = false;
1595
 
1595