Subversion Repositories spk

Rev

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

Rev 102 Rev 185
Line 13... Line 13...
13
*/
13
*/
14
int main ( int argc, char **argv )
14
int main ( int argc, char **argv )
15
{
15
{
16
	printf ( "XModPatch V1.00 (SPK Library Version %.2f) 01/04/2011 Created by Cycrow\n\n", (float)GetLibraryVersion() );
16
	printf ( "XModPatch V1.00 (SPK Library Version %.2f) 01/04/2011 Created by Cycrow\n\n", (float)GetLibraryVersion() );
17
 
17
 
18
	CyString cmd (argv[0]);
18
	Utils::String cmd (argv[0]);
19
	CyString dir = CFileIO(cmd).dir();
19
	Utils::String dir = CFileIO(cmd).dir();
20
	cmd = CFileIO(cmd).filename();
20
	cmd = CFileIO(cmd).filename();
21
 
21
 
22
	bool verbose = false;
22
	bool verbose = false;
23
 
23
 
24
	if ( argc < 3 )
24
	if ( argc < 3 )
Line 53... Line 53...
53
			}
53
			}
54
			else if ( checkFlags.Compare("--verbose") )
54
			else if ( checkFlags.Compare("--verbose") )
55
				verbose = true;
55
				verbose = true;
56
		}
56
		}
57
 
57
 
58
		CyString modfile(argv[startPos]);
58
		Utils::String modfile(argv[startPos]);
59
		CyString difffile(argv[startPos + 1]);
59
		Utils::String difffile(argv[startPos + 1]);
60
		CyString gamedir;
60
		Utils::String gamedir;
61
		if ( argc > 3 ) gamedir = argv[startPos + 2];
61
		if ( argc > 3 ) gamedir = argv[startPos + 2];
62
		if ( gamedir.Empty() ) gamedir = ".";
62
		if ( gamedir.empty() ) gamedir = ".";
63
		gamedir = CFileIO(gamedir).fullFilename();
63
		gamedir = CFileIO(gamedir).fullFilename();
64
 
64
 
65
		CModDiff Diff(gamedir.ToString(), "addon");
65
		CModDiff Diff(gamedir, "addon");
66
		if ( !Diff.IsLoaded() ) 
66
		if ( !Diff.IsLoaded() ) 
67
		{
67
		{
68
			printf  ("Error: Unable to load game directory, %s\n", gamedir.c_str());
68
			printf  ("Error: Unable to load game directory, %s\n", gamedir.c_str());
69
			Error();
69
			Error();
70
		}
70
		}
71
 
71
 
72
		Diff.ApplyMod(modfile.ToString());
72
		Diff.ApplyMod(modfile);
73
 
73
 
74
		printf ( "Game Directory: '%s' loaded\n", gamedir.c_str());
74
		printf ( "Game Directory: '%s' loaded\n", gamedir.c_str());
75
		if ( !Diff.ReadDiff(difffile.ToString()) )
75
		if ( !Diff.ReadDiff(difffile) )
76
		{
76
		{
77
			printf ("Error: Unable to load diff file, %s\n", difffile.c_str());
77
			printf ("Error: Unable to load diff file, %s\n", difffile.c_str());
78
			Error();
78
			Error();
79
		}
79
		}
80
 
80
 
81
		if ( !Diff.ApplyDiff(modfile.ToString()) )
81
		if ( !Diff.ApplyDiff(modfile) )
82
		{
82
		{
83
			printf ("Error: Unable to write to mod file, %s\n", modfile.c_str());
83
			printf ("Error: Unable to write to mod file, %s\n", modfile.c_str());
84
			Error();
84
			Error();
85
		}
85
		}
86
 
86