diff --git a/OpenRA.FileFormats/Filesystem/FileSystem.cs b/OpenRA.FileFormats/Filesystem/FileSystem.cs index e6457c48d3..d08a807201 100644 --- a/OpenRA.FileFormats/Filesystem/FileSystem.cs +++ b/OpenRA.FileFormats/Filesystem/FileSystem.cs @@ -72,7 +72,6 @@ namespace OpenRA.FileFormats public static void Mount(string name) { - var start = name; var optional = name.StartsWith("~"); if (optional) name = name.Substring(1); diff --git a/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs index 931d1de496..7f1743f471 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/GameInitDelegate.cs @@ -60,14 +60,23 @@ namespace OpenRA.Mods.RA.Widgets.Delegates } }; - if (FileSystem.Exists(Info.TestFile)) - ContinueLoading(); + TestAndContinue(); + } + + void TestAndContinue() + { + if (FileSystem.Exists(Info.TestFile)) + { + Game.LoadShellMap(); + Widget.RootWidget.RemoveChildren(); + Widget.OpenWindow("MAINMENU_BG"); + } else { MainMenuButtonsDelegate.DisplayModSelector(); ShowInstallMethodDialog(); } - } + } void ShowInstallMethodDialog() { @@ -99,10 +108,20 @@ namespace OpenRA.Mods.RA.Widgets.Delegates window.GetWidget("CANCEL").OnMouseUp = mi => { ShowInstallMethodDialog(); return true; }; window.GetWidget("RETRY").OnMouseUp = mi => PromptForCD(); - if (Info.InstallMode != "ra") - ShowDownloadError(window, "Installing from CD not supported"); - else if (InstallRAPackages(window, path, Info.ResolvedPackagePath)) - Game.RunAfterTick(ContinueLoading); + 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; + default: + ShowDownloadError(window, "Installing from CD not supported"); + break; + } } void ShowDownloadDialog() @@ -131,7 +150,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates progress.Indeterminate = true; if (ExtractZip(window, file, Info.ResolvedPackagePath)) - Game.RunAfterTick(ContinueLoading); + Game.RunAfterTick(TestAndContinue); } }; @@ -150,13 +169,6 @@ namespace OpenRA.Mods.RA.Widgets.Delegates window.GetWidget("CANCEL").IsVisible = () => true; } } - - void ContinueLoading() - { - Game.LoadShellMap(); - Widget.RootWidget.RemoveChildren(); - Widget.OpenWindow("MAINMENU_BG"); - } // General support methods public class Download @@ -265,6 +277,17 @@ namespace OpenRA.Mods.RA.Widgets.Delegates new string[] { "conquer.mix", "russian.mix", "allies.mix", "sounds.mix", "scores.mix", "snow.mix", "interior.mix", "temperat.mix" }, dest); } + + bool InstallCncPackages(Widget window, string source, string dest) + { + if (!CopyFiles(window, source, + new string[] { "CONQUER.MIX", "DESERT.MIX", "GENERAL.MIX", "SCORES.MIX", + "SOUNDS.MIX", "TEMPERAT.MIX", "WINTER.MIX"}, + dest)) + return false; + return ExtractFromPackage(window, source, "INSTALL/SETUP.Z", + new string[] { "cclocal.mix", "speech.mix", "tempicnh.mix", "updatec.mix" }, dest); + } } static class InstallUtils diff --git a/mods/cnc/chrome/gameinit.yaml b/mods/cnc/chrome/gameinit.yaml index 0b4978bfe1..cbff1eb4b8 100644 --- a/mods/cnc/chrome/gameinit.yaml +++ b/mods/cnc/chrome/gameinit.yaml @@ -34,14 +34,11 @@ Background@INIT_CHOOSEINSTALL: Y:70 Width:PARENT_RIGHT Height:25 -# Text:Content can be downloaded, or copied from the install CD. - Text:A 6.1MB download is required. + Text:Content can be downloaded, or copied from the install CD. Align:Center Button@DOWNLOAD: Id:DOWNLOAD -# X:PARENT_RIGHT - 420 -# Y:PARENT_BOTTOM - 45 - X:PARENT_RIGHT - 280 + X:PARENT_RIGHT - 420 Y:PARENT_BOTTOM - 45 Width:120 Height:25 @@ -54,7 +51,6 @@ Background@INIT_CHOOSEINSTALL: Width:120 Height:25 Text:From CD - Visible:false Bold:True Button@QUIT: Id:QUIT