Load last mod on startup.

This commit is contained in:
Paul Chote
2011-01-27 20:40:29 +13:00
parent 38b98bf358
commit 492c025844
5 changed files with 6 additions and 6 deletions

View File

@@ -266,6 +266,8 @@ namespace OpenRA
// Discard any invalid mods // Discard any invalid mods
var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray(); var mm = mods.Where( m => Mod.AllMods.ContainsKey( m ) ).ToArray();
Console.WriteLine("Loading mods: {0}",string.Join(",",mm)); Console.WriteLine("Loading mods: {0}",string.Join(",",mm));
Settings.Game.Mods = mm;
Settings.Save();
Sound.Initialize(); Sound.Initialize();

View File

@@ -18,7 +18,7 @@
- (void)launchFilePicker:(NSArray *)args; - (void)launchFilePicker:(NSArray *)args;
- (void)extractZip:(NSArray *)args; - (void)extractZip:(NSArray *)args;
- (void)installRAPackages:(NSArray *)args; - (void)installRAPackages:(NSArray *)args;
- (void)launchMod:(NSString *)mod; - (void)launch;
- (BOOL)initMono; - (BOOL)initMono;
- (void)runUtilityWithArgs:(NSArray *)arg; - (void)runUtilityWithArgs:(NSArray *)arg;
- (void)utilityResponded:(NSNotification *)n; - (void)utilityResponded:(NSNotification *)n;

View File

@@ -50,7 +50,7 @@ extern char **environ;
[self installRAPackages:args]; [self installRAPackages:args];
else else
[self launchMod:@"cnc"]; [self launch];
[NSApp terminate: nil]; [NSApp terminate: nil];
} }
@@ -112,7 +112,7 @@ extern char **environ;
return ![response isEqualToString:@"Windowed\n"]; return ![response isEqualToString:@"Windowed\n"];
} }
-(void)launchMod:(NSString *)mod -(void)launch
{ {
// Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6 // Use LaunchServices because neither NSTask or NSWorkspace support Info.plist _and_ arguments pre-10.6
@@ -125,7 +125,6 @@ extern char **environ;
monoPath, monoPath,
[NSString stringWithFormat:@"UtilityPath=%@", [[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], [NSString stringWithFormat:@"UtilityPath=%@", [[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]],
[NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]], [NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]],
[NSString stringWithFormat:@"Game.Mods=%@",mod],
nil]; nil];
FSRef appRef; FSRef appRef;
CFURLGetFSRef((CFURLRef)[NSURL URLWithString:[[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], &appRef); CFURLGetFSRef((CFURLRef)[NSURL URLWithString:[[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], &appRef);

View File

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