diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 18be2fd1fb..fea8b57bbe 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -27,8 +27,6 @@ namespace OpenRA { public static class Game { - public static Utilities Utilities; - public static int CellSize { get { return modData.Manifest.TileSize; } } public static ModData modData; @@ -244,8 +242,6 @@ namespace OpenRA Console.WriteLine("Platform is {0}", Platform.CurrentPlatform); AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly; - - Utilities = new Utilities(args.GetValue("UtilityPath", "OpenRA.Utility.exe")); Settings = new Settings(Platform.SupportDir + "settings.yaml", args); Settings.Save(); diff --git a/OpenRA.Game/OpenRA.Game.csproj b/OpenRA.Game/OpenRA.Game.csproj index 8289d20004..8ce96ce671 100755 --- a/OpenRA.Game/OpenRA.Game.csproj +++ b/OpenRA.Game/OpenRA.Game.csproj @@ -177,7 +177,6 @@ - diff --git a/OpenRA.Game/Utilities.cs b/OpenRA.Game/Utilities.cs deleted file mode 100644 index ab96758dd9..0000000000 --- a/OpenRA.Game/Utilities.cs +++ /dev/null @@ -1,50 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using System; -using System.Diagnostics; - -namespace OpenRA -{ - public class Utilities - { - readonly string Utility; - - public Utilities(string utility) - { - Utility = utility; - } - - public void PromptFilepathAsync(string title, Action withPath) - { - ExecuteUtility("--display-filepicker \"{0}\"".F(title), withPath); - } - - void ExecuteUtility(string args, Action onComplete) - { - try - { - Process p = new Process(); - p.StartInfo.FileName = Utility; - p.StartInfo.Arguments = args; - p.StartInfo.CreateNoWindow = true; - p.StartInfo.UseShellExecute = false; - p.StartInfo.RedirectStandardOutput = true; - p.EnableRaisingEvents = true; - p.Exited += (_,e) => - { - onComplete(p.StandardOutput.ReadToEnd().Trim()); - }; - p.Start(); - } - catch(System.ComponentModel.Win32Exception) {} // Don't crash if the process fails - } - } -} diff --git a/OpenRA.Launcher.Mac/Controller.h b/OpenRA.Launcher.Mac/Controller.h index 784e429512..df1d562fae 100644 --- a/OpenRA.Launcher.Mac/Controller.h +++ b/OpenRA.Launcher.Mac/Controller.h @@ -15,7 +15,6 @@ IBOutlet NSWindow *window; } -- (void)launchFilePicker:(NSArray *)args; - (void)launch; - (BOOL)initMono; - (BOOL)shouldHideMenubar; diff --git a/OpenRA.Launcher.Mac/Controller.m b/OpenRA.Launcher.Mac/Controller.m index 9a5cfee9b7..3e2a965484 100644 --- a/OpenRA.Launcher.Mac/Controller.m +++ b/OpenRA.Launcher.Mac/Controller.m @@ -19,7 +19,6 @@ extern char **environ; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - NSArray *args = [[NSProcessInfo processInfo] arguments]; gamePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gamepath"]; // Try and launch the game @@ -37,36 +36,10 @@ extern char **environ; [[NSApplication sharedApplication] terminate:self]; } - // Ingame requests for native dialogs - if ([args containsObject:@"--display-filepicker"]) - [self launchFilePicker:args]; - else - [self launch]; - + [self launch]; [NSApp terminate: nil]; } -- (void)launchFilePicker:(NSArray *)args -{ - [NSApp activateIgnoringOtherApps:YES]; - - if ([self shouldHideMenubar]) - [NSMenu setMenuBarVisible:NO]; - - NSOpenPanel *op = [NSOpenPanel openPanel]; - [op setLevel:CGShieldingWindowLevel()]; - [op setAllowsMultipleSelection:NO]; - - NSUInteger a = [args indexOfObject:@"--display-filepicker"]; - if (a != NSNotFound) - [op setTitle:[args objectAtIndex:a+1]]; - - if ([op runModal] == NSFileHandlingPanelOKButton) - printf("%s\n", [[[op URL] path] UTF8String]); - - [NSApp terminate: nil]; -} - - (BOOL)shouldHideMenubar { NSTask *task = [[[NSTask alloc] init] autorelease]; @@ -113,7 +86,6 @@ extern char **environ; [self shouldHideMenubar] ? @"--hide-menubar" : @"--no-hide-menubar", gamePath, monoPath, - [NSString stringWithFormat:@"UtilityPath=%@", [[NSBundle mainBundle] executablePath]], nil]; FSRef appRef; CFURLGetFSRef((CFURLRef)[NSURL URLWithString:[[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], &appRef); diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA index b9b0a89b45..d6f38b4caf 100755 Binary files a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA and b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA differ diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib index 1a8f36a358..931c5c3ab7 100644 Binary files a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib and b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib differ diff --git a/OpenRA.Launcher.Mac/main.m b/OpenRA.Launcher.Mac/main.m index 27f8b253da..f5d8b20faf 100644 --- a/OpenRA.Launcher.Mac/main.m +++ b/OpenRA.Launcher.Mac/main.m @@ -13,8 +13,11 @@ int main(int argc, char *argv[]) { /* When launching a mod, the arguments are of the form * --launch */ - if (argc >= 6 && strcmp(argv[1], "--launch") == 0) + if (argc > 1 && strcmp(argv[1], "--launch") == 0) { + if (argc < 5) + exit(1); + /* Change into the game dir */ chdir(argv[3]); @@ -23,7 +26,6 @@ int main(int argc, char *argv[]) argv[4], "--debug", "OpenRA.Game.exe", - argv[5], NULL }; diff --git a/OpenRA.Mods.RA/Widgets/Logic/GameInitLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/GameInitLogic.cs index 3846987f52..ed05608262 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/GameInitLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/GameInitLogic.cs @@ -66,11 +66,8 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (FileSystem.Exists(Info.TestFile)) { Game.LoadShellMap(); - if (Info.InstallMode != "cnc") - { - Widget.ResetAll(); - Widget.OpenWindow("MAINMENU_BG"); - } + Widget.ResetAll(); + Widget.OpenWindow("MAINMENU_BG"); } else { @@ -90,13 +87,9 @@ namespace OpenRA.Mods.RA.Widgets.Logic void PromptForCD() { - Game.Utilities.PromptFilepathAsync("Select MAIN.MIX on the CD", path => - { - if (!string.IsNullOrEmpty(path)) - Game.RunAfterTick(() => InstallFromCD(Path.GetDirectoryName(path))); - }); + // TODO: Automatically search for cds } - + void InstallFromCD(string path) { var window = Widget.OpenWindow("INIT_COPY"); @@ -112,14 +105,10 @@ namespace OpenRA.Mods.RA.Widgets.Logic { switch (Info.InstallMode) { - case "ra": - if (InstallRAPackages(window, path, Info.ResolvedPackagePath)) - Game.RunAfterTick(TestAndContinue); - break; - case "cnc": - if (InstallCncPackages(window, path, Info.ResolvedPackagePath)) - Game.RunAfterTick(TestAndContinue); - break; +// case "ra": +// if (InstallPackages(window, path, Info.ResolvedPackagePath)) +// Game.RunAfterTick(TestAndContinue); +// break; default: ShowError(window, "Installing from CD not supported"); break; @@ -198,7 +187,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic e => ShowError(window, e)); } - bool InstallRAPackages(Widget window, string source, string dest) + bool InstallPackages(Widget window, string source, string dest) { if (!CopyFiles(window, Path.Combine(source, "INSTALL"), new string[] {"REDALERT.MIX"}, dest)) return false; diff --git a/OpenRA.Utility/Command.cs b/OpenRA.Utility/Command.cs index df8c67c88f..fda30f8c51 100644 --- a/OpenRA.Utility/Command.cs +++ b/OpenRA.Utility/Command.cs @@ -24,19 +24,6 @@ namespace OpenRA.Utility { static class Command { - public static void DisplayFilepicker(string[] args) - { - if (args.Length < 2) - { - Console.WriteLine("Error: Invalid syntax"); - return; - } - - using (var dialog = new OpenFileDialog() { Title = args[1] }) - if (dialog.ShowDialog() == DialogResult.OK) - Console.WriteLine(dialog.FileName); - } - public static void Settings(string[] args) { if (args.Length < 2) @@ -122,7 +109,7 @@ namespace OpenRA.Utility bitmap.Save(dest); } } - + public static void ConvertFormat2ToFormat80(string[] args) { var src = args[1]; diff --git a/OpenRA.Utility/Program.cs b/OpenRA.Utility/Program.cs index 6c76c17d8a..112d3313cb 100644 --- a/OpenRA.Utility/Program.cs +++ b/OpenRA.Utility/Program.cs @@ -21,7 +21,6 @@ namespace OpenRA.Utility { var actions = new Dictionary>() { - { "--display-filepicker", Command.DisplayFilepicker }, { "--settings-value", Command.Settings }, { "--shp", Command.ConvertPngToShp }, { "--png", Command.ConvertShpToPng },