diff --git a/OpenRA.Game/InstallUtils.cs b/OpenRA.Game/InstallUtils.cs index b3a2449f7f..95f89b0127 100644 --- a/OpenRA.Game/InstallUtils.cs +++ b/OpenRA.Game/InstallUtils.cs @@ -20,8 +20,9 @@ namespace OpenRA { public class InstallData { - public readonly string InstallerMenuWidget = null; - public readonly string InstallerBackgroundWidget = null; + public readonly string MenuWidget = null; + public readonly string MusicMenuWidget = null; + public readonly string BackgroundWidget = null; public readonly string[] TestFiles = {}; public readonly string[] DiskTestFiles = {}; public readonly string PackageToExtractFromCD = null; diff --git a/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs b/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs index 4074bc50a8..1649fc3986 100644 --- a/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs +++ b/OpenRA.Mods.Common/LoadScreens/BlankLoadScreen.cs @@ -29,50 +29,45 @@ namespace OpenRA.Mods.Common.LoadScreens Game.Renderer.EndFrame(new NullInputHandler()); } - void TestAndContinue() - { - Ui.ResetAll(); - var installData = Game.modData.Manifest.ContentInstaller; - if (!installData.TestFiles.All(f => GlobalFileSystem.Exists(f))) - { - var args = new WidgetArgs() - { - { "continueLoading", () => Game.InitializeMod(Game.Settings.Game.Mod, null) }, - }; - - if (installData.InstallerBackgroundWidget != null) - Ui.LoadWidget(installData.InstallerBackgroundWidget, Ui.Root, args); - - Ui.OpenWindow(installData.InstallerMenuWidget, args); - } - else - Game.LoadShellMap(); - - Game.Settings.Save(); - } - public void StartGame(Arguments args) { - var window = args != null ? args.GetValue("Launch.Window", null) : null; - if (!string.IsNullOrEmpty(window)) - { - var installData = Game.modData.Manifest.ContentInstaller; - if (installData.InstallerBackgroundWidget != null) - Ui.LoadWidget(installData.InstallerBackgroundWidget, Ui.Root, new WidgetArgs()); + Ui.ResetAll(); + Game.Settings.Save(); - Ui.OpenWindow(window, new WidgetArgs()); - } - else - { - TestAndContinue(); + // Check whether the mod content is installed + // TODO: The installation code has finally been beaten into shape, so we can + // finally move it all into the planned "Manage Content" panel in the modchooser mod. + var installData = Game.modData.Manifest.ContentInstaller; + var installModContent = !installData.TestFiles.All(f => GlobalFileSystem.Exists(f)); + var installModMusic = args != null && args.Contains("Install.Music"); - var replay = args != null ? args.GetValue("Launch.Replay", null) : null; - if (!string.IsNullOrEmpty(replay)) - Game.JoinReplay(replay); + if (installModContent || installModMusic) + { + var widgetArgs = new WidgetArgs() + { + { "continueLoading", () => Game.InitializeMod(Game.Settings.Game.Mod, args) }, + }; + + if (installData.BackgroundWidget != null) + Ui.LoadWidget(installData.BackgroundWidget, Ui.Root, widgetArgs); + + var menu = installModContent ? installData.MenuWidget : installData.MusicMenuWidget; + Ui.OpenWindow(menu, widgetArgs); + + return; } + + var replay = args != null ? args.GetValue("Launch.Replay", null) : null; + if (!string.IsNullOrEmpty(replay)) + { + Game.JoinReplay(replay); + return; + } + + Game.LoadShellMap(); + Game.Settings.Save(); } public virtual void Dispose() { } } -} - +} \ No newline at end of file diff --git a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs index c3d1252729..692b1ede52 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MusicPlayerLogic.cs @@ -85,7 +85,7 @@ namespace OpenRA.Mods.RA.Widgets.Logic if (installButton != null) { installButton.IsDisabled = () => world == null || !world.IsShellmap; - var args = new string[] { "Launch.Window=INSTALL_MUSIC_PANEL" }; + var args = new string[] { "Install.Music=true" }; installButton.OnClick = () => { Game.modData.LoadScreen.Display(); // HACK: prevent a flicker when transitioning to the installation dialog diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 7cdb8baf1d..d9f10c2634 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -138,8 +138,9 @@ LoadScreen: CncLoadScreen ContentInstaller: TestFiles: conquer.mix, desert.mix, sounds.mix, speech.mix, temperat.mix, tempicnh.mix, winter.mix - InstallerBackgroundWidget: INSTALL_BACKGROUND - InstallerMenuWidget: INSTALL_PANEL + BackgroundWidget: INSTALL_BACKGROUND + MenuWidget: INSTALL_PANEL + MusicMenuWidget: INSTALL_MUSIC_PANEL FilesToCopy: CONQUER.MIX, DESERT.MIX, SCORES.MIX, SOUNDS.MIX, TEMPERAT.MIX, WINTER.MIX FilesToExtract: speech.mix, tempicnh.mix, transit.mix PackageMirrorList: http://www.openra.net/packages/cnc-mirrors.txt diff --git a/mods/d2k/mod.yaml b/mods/d2k/mod.yaml index 7a47f5d1db..fa729a95e3 100644 --- a/mods/d2k/mod.yaml +++ b/mods/d2k/mod.yaml @@ -122,7 +122,8 @@ LoadScreen: LogoStripeLoadScreen Text: Filling Crates..., Breeding Sandworms... ContentInstaller: - InstallerMenuWidget: INSTALL_PANEL + MenuWidget: INSTALL_PANEL + MusicMenuWidget: INSTALL_MUSIC_PANEL # TODO: check if DATA.R8 is at 1.03 patch level with 4840 frames TestFiles: BLOXBASE.R8, BLOXBAT.R8, BLOXBGBS.R8, BLOXICE.R8, BLOXTREE.R8, BLOXWAST.R8, DATA.R8, SOUND.RS PackageMirrorList: http://www.openra.net/packages/d2k-103-mirrors.txt diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index bbdff772b3..7a888b3089 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -137,7 +137,8 @@ LoadScreen: LogoStripeLoadScreen Text: Filling Crates..., Charging Capacitors..., Reticulating Splines..., Planting Trees..., Building Bridges..., Aging Empires..., Compiling EVA..., Constructing Pylons..., Activating Skynet..., Splitting Atoms... ContentInstaller: - InstallerMenuWidget: INSTALL_PANEL + MenuWidget: INSTALL_PANEL + MusicMenuWidget: INSTALL_MUSIC_PANEL TestFiles: allies.mix, conquer.mix, interior.mix, redalert.mix, russian.mix, snow.mix, sounds.mix, temperat.mix PackageMirrorList: http://www.openra.net/packages/ra-mirrors.txt DiskTestFiles: MAIN.MIX, INSTALL/REDALERT.MIX diff --git a/mods/ts/mod.yaml b/mods/ts/mod.yaml index 997fe876d2..78f54919b5 100644 --- a/mods/ts/mod.yaml +++ b/mods/ts/mod.yaml @@ -167,7 +167,8 @@ LoadScreen: LogoStripeLoadScreen Text: Updating EVA installation..., Changing perspective... ContentInstaller: - InstallerMenuWidget: INSTALL_PANEL + MenuWidget: INSTALL_PANEL + MusicMenuWidget: INSTALL_MUSIC_PANEL TestFiles: cache.mix, conquer.mix, isosnow.mix, isotemp.mix, local.mix, sidec01.mix, sidec02.mix, sno.mix, snow.mix, sounds.mix, speech01.mix, tem.mix, temperat.mix PackageMirrorList: http://www.openra.net/packages/ts-mirrors.txt DiskTestFiles: MULTI.MIX, INSTALL/TIBSUN.MIX