Begin refactoring utility process launching.

This commit is contained in:
Paul Chote
2011-01-22 11:10:14 +13:00
parent 388e5df377
commit aa319ee403
7 changed files with 110 additions and 81 deletions

View File

@@ -36,14 +36,13 @@
otherButton:nil
informativeTextWithFormat:@"OpenRA requires the Mono Framework version 2.6.7 or later."];
if ([alert runModal] == NSAlertDefaultReturn)
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.go-mono.com/mono-downloads/download.html"]];
[[NSApplication sharedApplication] terminate:self];
}
[self launchMod:@"ra"];
[self launchMod:@"cnc"];
[NSApp terminate: nil];
}
@@ -94,6 +93,7 @@
// Second...Nth arguments are passed to OpenRA.Game.exe
// Launcher wrapper sets mono --debug, gl renderer and support dir.
NSArray *args = [NSArray arrayWithObjects:@"--launch", gamePath, monoPath,
[NSString stringWithFormat:@"NativeUtilityPath=%@", [[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]],
[NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]],
[NSString stringWithFormat:@"Game.Mods=%@",mod],
nil];
@@ -113,7 +113,7 @@
ProcessSerialNumber psn;
OSStatus err = LSOpenApplication(&params, &psn);
// Bring the game window to the front
if (err == noErr)
SetFrontProcess(&psn);

View File

@@ -13,8 +13,8 @@ extern char **environ;
int main(int argc, char *argv[])
{
/* When launching a mod, the arguments are of the form
* --launch <game dir> <support dir option> <mod option> */
if (argc >= 5 && strcmp(argv[1], "--launch") == 0)
* --launch <game dir> <mono path> <utility path> <support dir option> <mod option> */
if (argc >= 6 && strcmp(argv[1], "--launch") == 0)
{
/* Change into the game dir */
chdir(argv[2]);
@@ -26,6 +26,7 @@ int main(int argc, char *argv[])
"OpenRA.Game.exe",
argv[4],
argv[5],
argv[6],
NULL
};