Merge pull request #13049 from pchote/mod-content

Remove ingame mod chooser.
This commit is contained in:
Oliver Brakmann
2017-04-21 19:16:49 +02:00
committed by GitHub
42 changed files with 119 additions and 598 deletions

View File

@@ -313,12 +313,11 @@ dependencies: $(os-dependencies)
all-dependencies: cli-dependencies windows-dependencies osx-dependencies
version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modchooser/mod.yaml mods/all/mod.yaml
version: mods/ra/mod.yaml mods/cnc/mod.yaml mods/d2k/mod.yaml mods/ts/mod.yaml mods/modcontent/mod.yaml mods/all/mod.yaml
@for i in $? ; do \
awk '{sub("Version:.*$$","Version: $(VERSION)"); print $0}' $${i} > $${i}.tmp && \
awk '{sub("\tmodchooser:.*$$","\tmodchooser: $(VERSION)"); print $0}' $${i}.tmp > $${i}.tmp2 && \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $${i}.tmp2 > $${i} && \
rm $${i}.tmp $${i}.tmp2; \
awk '{sub("/[^/]*: User$$", "/$(VERSION): User"); print $0}' $${i}.tmp > $${i} && \
rm $${i}.tmp; \
done
docs: utility mods version
@@ -344,7 +343,7 @@ install-core: default
@$(CP_R) mods/ra "$(DATA_INSTALL_DIR)/mods/"
@$(CP_R) mods/d2k "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_PROGRAM) $(mod_d2k_TARGET) "$(DATA_INSTALL_DIR)/mods/d2k"
@$(CP_R) mods/modchooser "$(DATA_INSTALL_DIR)/mods/"
@$(CP_R) mods/modcontent "$(DATA_INSTALL_DIR)/mods/"
@$(INSTALL_DATA) "global mix database.dat" "$(DATA_INSTALL_DIR)/global mix database.dat"
@$(INSTALL_DATA) "GeoLite2-Country.mmdb.gz" "$(DATA_INSTALL_DIR)/GeoLite2-Country.mmdb.gz"
@@ -382,8 +381,6 @@ install-linux-mime:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-join-servers.desktop "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-replays.desktop "$(DESTDIR)$(datadir)/applications"
@$(INSTALL_DATA) packaging/linux/openra-launch-mod.desktop "$(DESTDIR)$(datadir)/applications"
install-linux-appdata:
@$(INSTALL_DIR) "$(DESTDIR)$(datadir)/appdata/"

View File

@@ -50,8 +50,6 @@ namespace OpenRA.FileSystem
return new ZipFile(this, filename);
if (filename.EndsWith(".oramap", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(this, filename);
if (filename.EndsWith(".oramod", StringComparison.InvariantCultureIgnoreCase))
return new ZipFile(this, filename);
if (filename.EndsWith(".RS", StringComparison.InvariantCultureIgnoreCase))
return new D2kSoundResources(this, filename);
if (filename.EndsWith(".Z", StringComparison.InvariantCultureIgnoreCase))

View File

@@ -248,12 +248,12 @@ namespace OpenRA
// Special case handling of Game.Mod argument: if it matches a real filesystem path
// then we use this to override the mod search path, and replace it with the mod id
var modArgument = args.GetValue("Game.Mod", null);
var modID = args.GetValue("Game.Mod", null);
var explicitModPaths = new string[0];
if (modArgument != null && (File.Exists(modArgument) || Directory.Exists(modArgument)))
if (modID != null && (File.Exists(modID) || Directory.Exists(modID)))
{
explicitModPaths = new[] { modArgument };
args.ReplaceValue("Game.Mod", Path.GetFileNameWithoutExtension(modArgument));
explicitModPaths = new[] { modID };
modID = Path.GetFileNameWithoutExtension(modID);
}
InitializeSettings(args);
@@ -317,7 +317,7 @@ namespace OpenRA
var modSearchArg = args.GetValue("Engine.ModSearchPaths", null);
var modSearchPaths = modSearchArg != null ?
FieldLoader.GetValue<string[]>("Engine.ModsPath", modSearchArg) :
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
new[] { Path.Combine(".", "mods") };
Mods = new InstalledMods(modSearchPaths, explicitModPaths);
Console.WriteLine("Internal mods:");
@@ -330,19 +330,7 @@ namespace OpenRA
foreach (var mod in ExternalMods)
Console.WriteLine("\t{0}: {1} ({2})", mod.Key, mod.Value.Title, mod.Value.Version);
InitializeMod(Settings.Game.Mod, args);
}
public static bool IsModInstalled(string modId)
{
return Mods.ContainsKey(modId) && Mods[modId].RequiresMods.All(IsModInstalled);
}
public static bool IsModInstalled(KeyValuePair<string, string> mod)
{
return Mods.ContainsKey(mod.Key)
&& Mods[mod.Key].Metadata.Version == mod.Value
&& IsModInstalled(mod.Key);
InitializeMod(modID, args);
}
public static void InitializeMod(string mod, Arguments args)
@@ -372,12 +360,10 @@ namespace OpenRA
ModData = null;
// Fall back to default if the mod doesn't exist or has missing prerequisites.
if (mod == null || !IsModInstalled(mod))
mod = args.GetValue("Engine.DefaultMod", "modchooser");
if (mod == null)
throw new InvalidOperationException("Game.Mod argument missing or mod could not be found.");
Console.WriteLine("Loading mod: {0}", mod);
Settings.Game.Mod = mod;
Sound.StopVideo();

View File

@@ -53,9 +53,6 @@ namespace OpenRA
var directory = new DirectoryInfo(resolved);
foreach (var subdir in directory.EnumerateDirectories())
mods.Add(Pair.New(subdir.Name, subdir.FullName));
foreach (var file in directory.EnumerateFiles("*.oramod"))
mods.Add(Pair.New(Path.GetFileNameWithoutExtension(file.Name), file.FullName));
}
catch (Exception e)
{
@@ -94,8 +91,6 @@ namespace OpenRA
using (var bitmap = new Bitmap(stream))
icons[id] = sheetBuilder.Add(bitmap);
// Mods in the support directory and oramod packages (which are listed later
// in the CandidateMods list) override mods in the main install.
return new Manifest(id, package);
}
catch (Exception)

View File

@@ -55,8 +55,6 @@ namespace OpenRA
public readonly IReadOnlyDictionary<string, string> Packages;
public readonly IReadOnlyDictionary<string, string> MapFolders;
public readonly MiniYaml LoadScreen;
public readonly Dictionary<string, string> RequiresMods;
public readonly Dictionary<string, Pair<string, int>> Fonts;
public readonly string[] SoundFormats = { };
@@ -115,8 +113,6 @@ namespace OpenRA
return Pair.New(nd["Font"].Value, Exts.ParseIntegerInvariant(nd["Size"].Value));
});
RequiresMods = yaml["RequiresMods"].ToDictionary(my => my.Value);
// Allow inherited mods to import parent maps.
var compat = new List<string> { Id };

View File

@@ -154,10 +154,6 @@ namespace OpenRA
public class GameSettings
{
[Desc("Load a specific mod on startup.")]
public string Mod = null;
public string PreviousMod = "ra";
public string Platform = "Default";
public bool ViewportEdgeScroll = true;

View File

@@ -124,7 +124,7 @@ namespace OpenRA.Mods.Common.LoadScreens
if (contentInstalled)
return true;
Game.InitializeMod(content.ContentInstallerMod, new Arguments());
Game.InitializeMod(content.ContentInstallerMod, new Arguments(new[] { "Content.Mod=" + modData.Manifest.Id }));
return false;
}
}

View File

@@ -9,14 +9,17 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.LoadScreens
{
public sealed class ModChooserLoadScreen : ILoadScreen
public sealed class ModContentLoadScreen : ILoadScreen
{
Sprite sprite;
Rectangle bounds;
@@ -46,10 +49,46 @@ namespace OpenRA.Mods.Common.LoadScreens
public void StartGame(Arguments args)
{
var widgetArgs = new WidgetArgs();
var modId = args.GetValue("Content.Mod", null);
Manifest selectedMod;
if (modId == null || !Game.Mods.TryGetValue(modId, out selectedMod))
throw new InvalidOperationException("Invalid or missing Content.Mod argument.");
Ui.LoadWidget("MODCHOOSER_BACKGROUND", Ui.Root, widgetArgs);
Ui.OpenWindow("MODCHOOSER_DIALOG", widgetArgs);
var content = selectedMod.Get<ModContent>(Game.ModData.ObjectCreator);
Ui.LoadWidget("MODCONTENT_BACKGROUND", Ui.Root, new WidgetArgs());
if (!IsModInstalled(content))
{
var widgetArgs = new WidgetArgs
{
{ "continueLoading", () =>
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) },
{ "mod", selectedMod },
{ "content", content },
};
Ui.OpenWindow("CONTENT_PROMPT_PANEL", widgetArgs);
}
else
{
var widgetArgs = new WidgetArgs
{
{ "mod", selectedMod },
{ "content", content },
{ "onCancel", () =>
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) }
};
Ui.OpenWindow("CONTENT_PANEL", widgetArgs);
}
}
bool IsModInstalled(ModContent content)
{
return content.Packages
.Where(p => p.Value.Required)
.All(p => p.Value.TestFiles.All(f => File.Exists(Platform.ResolvePath(f))));
}
public void Dispose()

View File

@@ -85,7 +85,7 @@ namespace OpenRA
public readonly string InstallPromptMessage;
public readonly string QuickDownload;
public readonly string HeaderMessage;
public readonly string ContentInstallerMod = "modchooser";
public readonly string ContentInstallerMod = "modcontent";
[FieldLoader.LoadUsing("LoadPackages")]
public readonly Dictionary<string, ModPackage> Packages = new Dictionary<string, ModPackage>();

View File

@@ -184,7 +184,7 @@
<Compile Include="Lint\CheckTargetHealthRadius.cs" />
<Compile Include="Lint\LintBuildablePrerequisites.cs" />
<Compile Include="Lint\LintExts.cs" />
<Compile Include="LoadScreens\ModChooserLoadScreen.cs" />
<Compile Include="LoadScreens\ModContentLoadScreen.cs" />
<Compile Include="ActorInitializer.cs" />
<Compile Include="Scripting\Properties\AmmoPoolProperties.cs" />
<Compile Include="ShroudExts.cs" />
@@ -615,7 +615,6 @@
<Compile Include="Widgets\Logic\Ingame\SupportPowerBinLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\SupportPowerTooltipLogic.cs" />
<Compile Include="Widgets\Logic\Ingame\WorldTooltipLogic.cs" />
<Compile Include="Widgets\Logic\Installation\InstallModLogic.cs" />
<Compile Include="Widgets\Logic\Lobby\ClientTooltipLogic.cs" />
<Compile Include="Widgets\Logic\Lobby\KickClientLogic.cs" />
<Compile Include="Widgets\Logic\Lobby\KickSpectatorsLogic.cs" />
@@ -633,7 +632,6 @@
<Compile Include="Widgets\Logic\Editor\TileSelectorLogic.cs" />
<Compile Include="Widgets\Logic\MapChooserLogic.cs" />
<Compile Include="Widgets\Logic\MissionBrowserLogic.cs" />
<Compile Include="Widgets\Logic\ModBrowserLogic.cs" />
<Compile Include="Widgets\Logic\MusicPlayerLogic.cs" />
<Compile Include="Widgets\Logic\PerfDebugLogic.cs" />
<Compile Include="Widgets\Logic\ReplayBrowserLogic.cs" />

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine("openra \\- An Open Source modernization of the early 2D Command & Conquer games.");
Console.WriteLine(".SH SYNOPSIS");
Console.WriteLine(".B openra");
Console.WriteLine("[\\fB\\Game.Mod=\\fR\\fImodchooser\\fR]");
Console.WriteLine("[\\fB\\Game.Mod=\\fR\\fIra\\fR]");
Console.WriteLine(".SH DESCRIPTION");
Console.WriteLine(".B openra");
Console.WriteLine("starts the game.");
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.Write(".BR {0}.{1}=".F(section.Key, field.Name));
var value = field.GetValue(section.Value);
if (value != null && !value.ToString().StartsWith("System."))
if (value != null && !value.ToString().StartsWith("System.", StringComparison.Ordinal))
Console.WriteLine("\\fI{0}\\fR".F(value));
else
Console.WriteLine();
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine(".SH BUGS");
Console.WriteLine("Known issues are tracked at http://bugs.openra.net");
Console.WriteLine(".SH COPYRIGHT");
Console.WriteLine("Copyright 2007-2015 The OpenRA Developers (see AUTHORS)");
Console.WriteLine("Copyright 2007-2017 The OpenRA Developers (see AUTHORS)");
Console.WriteLine("This manual is part of OpenRA, which is free software. It is GNU GPL v3 licensed. See COPYING for details.");
}
}

View File

@@ -1,31 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Linq;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
{
public class InstallModLogic : ChromeLogic
{
[ObjectCreator.UseCtor]
public InstallModLogic(Widget widget, Manifest mod)
{
var panel = widget.Get("INSTALL_MOD_PANEL");
var mods = mod.RequiresMods.Where(m => !Game.IsModInstalled(m)).Select(m => "{0} ({1})".F(m.Key, m.Value));
var text = string.Join(", ", mods);
panel.Get<LabelWidget>("MOD_LIST").Text = text;
panel.Get<ButtonWidget>("BACK_BUTTON").OnClick = Ui.CloseWindow;
}
}
}

View File

@@ -46,7 +46,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
{ "mod", mod },
{ "content", content },
{ "onCancel", Ui.CloseWindow }
{ "onCancel", () => { } }
});
};
@@ -71,9 +71,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
});
};
var backButton = panel.Get<ButtonWidget>("BACK_BUTTON");
backButton.Bounds.Y += headerHeight;
backButton.OnClick = Ui.CloseWindow;
var quitButton = panel.Get<ButtonWidget>("QUIT_BUTTON");
quitButton.Bounds.Y += headerHeight;
quitButton.OnClick = Game.Exit;
Game.RunAfterTick(Ui.ResetTooltips);
}
}

View File

@@ -87,14 +87,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
});
};
mainMenu.Get<ButtonWidget>("MODS_BUTTON").OnClick = () =>
mainMenu.Get<ButtonWidget>("CONTENT_BUTTON").OnClick = () =>
{
// Switching mods changes the world state (by disposing it),
// so we can't do this inside the input handler.
Game.RunAfterTick(() =>
{
Game.Settings.Game.PreviousMod = modData.Manifest.Id;
Game.InitializeMod("modchooser", null);
Game.InitializeMod("modcontent", new Arguments(new[] { "Content.Mod=" + modData.Manifest.Id }));
});
};
@@ -288,7 +287,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
// Send the mod and engine version to support version-filtered news (update prompts)
newsURL += "?version={0}&mod={1}&modversion={2}".F(
Uri.EscapeUriString(Game.Mods["modchooser"].Metadata.Version),
Uri.EscapeUriString(Game.Mods["modcontent"].Metadata.Version),
Uri.EscapeUriString(Game.ModData.Manifest.Id),
Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version));

View File

@@ -1,225 +0,0 @@
#region Copyright & License Information
/*
* Copyright 2007-2017 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, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Primitives;
using OpenRA.Widgets;
namespace OpenRA.Mods.Common.Widgets.Logic
{
public class ModBrowserLogic : ChromeLogic
{
readonly Widget modList;
readonly ButtonWidget modTemplate;
readonly Manifest[] allMods;
readonly Dictionary<string, Sprite> previews = new Dictionary<string, Sprite>();
readonly Dictionary<string, Sprite> logos = new Dictionary<string, Sprite>();
readonly Cache<Manifest, ModContent> content = new Cache<Manifest, ModContent>(LoadModContent);
readonly Widget modChooserPanel;
readonly ButtonWidget loadButton;
readonly SheetBuilder sheetBuilder;
Manifest selectedMod;
string selectedAuthor;
string selectedDescription;
int modOffset = 0;
static ModContent LoadModContent(Manifest mod)
{
return mod.Get<ModContent>(Game.ModData.ObjectCreator);
}
[ObjectCreator.UseCtor]
public ModBrowserLogic(Widget widget, ModData modData)
{
modChooserPanel = widget;
loadButton = modChooserPanel.Get<ButtonWidget>("LOAD_BUTTON");
loadButton.OnClick = () => LoadMod(selectedMod);
loadButton.IsDisabled = () => selectedMod.Id == modData.Manifest.Id;
var contentButton = modChooserPanel.Get<ButtonWidget>("CONFIGURE_BUTTON");
contentButton.OnClick = () =>
{
var widgetArgs = new WidgetArgs
{
{ "mod", selectedMod },
{ "content", content[selectedMod] },
{ "onCancel", () => { } }
};
Ui.OpenWindow("CONTENT_PANEL", widgetArgs);
};
modChooserPanel.Get<ButtonWidget>("QUIT_BUTTON").OnClick = Game.Exit;
modList = modChooserPanel.Get("MOD_LIST");
modTemplate = modList.Get<ButtonWidget>("MOD_TEMPLATE");
modChooserPanel.Get<LabelWidget>("MOD_DESC").GetText = () => selectedDescription;
modChooserPanel.Get<LabelWidget>("MOD_TITLE").GetText = () => selectedMod.Metadata.Title;
modChooserPanel.Get<LabelWidget>("MOD_AUTHOR").GetText = () => selectedAuthor;
modChooserPanel.Get<LabelWidget>("MOD_VERSION").GetText = () => selectedMod.Metadata.Version;
var prevMod = modChooserPanel.Get<ButtonWidget>("PREV_MOD");
prevMod.OnClick = () => { modOffset -= 1; RebuildModList(); };
prevMod.IsVisible = () => modOffset > 0;
var nextMod = modChooserPanel.Get<ButtonWidget>("NEXT_MOD");
nextMod.OnClick = () => { modOffset += 1; RebuildModList(); };
nextMod.IsVisible = () => modOffset + 5 < allMods.Length;
modChooserPanel.Get<RGBASpriteWidget>("MOD_PREVIEW").GetSprite = () =>
{
Sprite ret = null;
previews.TryGetValue(selectedMod.Id, out ret);
return ret;
};
sheetBuilder = new SheetBuilder(SheetType.BGRA);
allMods = Game.Mods.Values.Where(m => !m.Metadata.Hidden)
.OrderBy(m => m.Metadata.Title)
.ToArray();
// Load preview images, and eat any errors
foreach (var mod in allMods)
{
try
{
using (var stream = mod.Package.GetStream("preview.png"))
using (var preview = new Bitmap(stream))
if (preview.Width == 296 && preview.Height == 196)
previews.Add(mod.Id, sheetBuilder.Add(preview));
}
catch (Exception) { }
try
{
using (var stream = mod.Package.GetStream("logo.png"))
using (var logo = new Bitmap(stream))
if (logo.Width == 96 && logo.Height == 96)
logos.Add(mod.Id, sheetBuilder.Add(logo));
}
catch (Exception) { }
}
Manifest initialMod;
Game.Mods.TryGetValue(Game.Settings.Game.PreviousMod, out initialMod);
SelectMod(initialMod != null && initialMod.Id != "modchooser" ? initialMod : Game.Mods["ra"]);
RebuildModList();
}
void RebuildModList()
{
modList.RemoveChildren();
var width = modTemplate.Bounds.Width;
var height = modTemplate.Bounds.Height;
var innerMargin = modTemplate.Bounds.Left;
var outerMargin = (modList.Bounds.Width - Math.Min(5, allMods.Length) * width - 4 * innerMargin) / 2;
var stride = width + innerMargin;
for (var i = 0; i < 5; i++)
{
var j = i + modOffset;
if (j >= allMods.Length)
break;
var mod = allMods[j];
var item = modTemplate.Clone() as ButtonWidget;
item.Bounds = new Rectangle(outerMargin + i * stride, 0, width, height);
item.IsHighlighted = () => selectedMod == mod;
item.OnClick = () => SelectMod(mod);
item.OnDoubleClick = () => LoadMod(mod);
item.OnKeyPress = e =>
{
if (e.MultiTapCount == 2)
LoadMod(mod);
else
SelectMod(mod);
};
item.TooltipText = mod.Metadata.Title;
if (j < 9)
item.Key = new Hotkey((Keycode)((int)Keycode.NUMBER_1 + j), Modifiers.None);
Sprite logo = null;
logos.TryGetValue(mod.Id, out logo);
item.Get<RGBASpriteWidget>("MOD_LOGO").GetSprite = () => logo;
item.Get("MOD_NO_LOGO").IsVisible = () => logo == null;
modList.AddChild(item);
}
}
void SelectMod(Manifest mod)
{
selectedMod = mod;
selectedAuthor = "By " + (mod.Metadata.Author ?? "unknown author");
selectedDescription = (mod.Metadata.Description ?? "").Replace("\\n", "\n");
var selectedIndex = Array.IndexOf(allMods, mod);
if (selectedIndex - modOffset > 4)
modOffset = selectedIndex - 4;
}
void LoadMod(Manifest mod)
{
var modId = mod.Id;
if (!Game.IsModInstalled(modId))
{
var widgetArgs = new WidgetArgs
{
{ "mod", selectedMod },
{ "content", content[selectedMod] },
};
Ui.OpenWindow("INSTALL_MOD_PANEL", widgetArgs);
return;
}
if (!IsModInstalled(mod))
{
var widgetArgs = new WidgetArgs
{
{ "continueLoading", () =>
Game.RunAfterTick(() => Game.InitializeMod(modId, new Arguments())) },
{ "mod", selectedMod },
{ "content", content[selectedMod] },
};
Ui.OpenWindow("CONTENT_PROMPT_PANEL", widgetArgs);
return;
}
Game.RunAfterTick(() =>
{
Ui.CloseWindow();
sheetBuilder.Dispose();
Game.InitializeMod(modId, null);
});
}
bool IsModInstalled(Manifest mod)
{
return content[mod].Packages
.Where(p => p.Value.Required)
.All(p => p.Value.TestFiles.All(f => File.Exists(Platform.ResolvePath(f))));
}
}
}

View File

@@ -326,7 +326,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
};
var queryURL = services.ServerList + "games?version={0}&mod={1}&modversion={2}".F(
Uri.EscapeUriString(Game.Mods["modchooser"].Metadata.Version),
Uri.EscapeUriString(Game.Mods["modcontent"].Metadata.Version),
Uri.EscapeUriString(Game.ModData.Manifest.Id),
Uri.EscapeUriString(Game.ModData.Manifest.Metadata.Version));

View File

@@ -30,14 +30,17 @@ namespace OpenRA.Server
// Special case handling of Game.Mod argument: if it matches a real filesystem path
// then we use this to override the mod search path, and replace it with the mod id
var modArgument = arguments.GetValue("Game.Mod", null);
var modID = arguments.GetValue("Game.Mod", null);
var explicitModPaths = new string[0];
if (modArgument != null && (File.Exists(modArgument) || Directory.Exists(modArgument)))
if (modID != null && (File.Exists(modID) || Directory.Exists(modID)))
{
explicitModPaths = new[] { modArgument };
arguments.ReplaceValue("Game.Mod", Path.GetFileNameWithoutExtension(modArgument));
explicitModPaths = new[] { modID };
modID = Path.GetFileNameWithoutExtension(modID);
}
if (modID == null)
throw new InvalidOperationException("Game.Mod argument missing or mod could not be found.");
// HACK: The engine code assumes that Game.Settings is set.
// This isn't nearly as bad as ModData, but is still not very nice.
Game.InitializeSettings(arguments);
@@ -46,18 +49,17 @@ namespace OpenRA.Server
var envModSearchPaths = Environment.GetEnvironmentVariable("MOD_SEARCH_PATHS");
var modSearchPaths = !string.IsNullOrWhiteSpace(envModSearchPaths) ?
FieldLoader.GetValue<string[]>("MOD_SEARCH_PATHS", envModSearchPaths) :
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
new[] { Path.Combine(".", "mods") };
var mod = Game.Settings.Game.Mod;
var mods = new InstalledMods(modSearchPaths, explicitModPaths);
// HACK: The engine code *still* assumes that Game.ModData is set
var modData = Game.ModData = new ModData(mods[mod], mods);
var modData = Game.ModData = new ModData(mods[modID], mods);
modData.MapCache.LoadMaps();
settings.Map = modData.MapCache.ChooseInitialMap(settings.Map, new MersenneTwister());
Console.WriteLine("[{0}] Starting dedicated server for mod: {1}", DateTime.Now.ToString(settings.TimestampFormat), mod);
Console.WriteLine("[{0}] Starting dedicated server for mod: {1}", DateTime.Now.ToString(settings.TimestampFormat), modID);
while (true)
{
var server = new Server(new IPEndPoint(IPAddress.Any, settings.ListenPort), settings, modData, true);

View File

@@ -48,7 +48,7 @@ namespace OpenRA
var envModSearchPaths = Environment.GetEnvironmentVariable("MOD_SEARCH_PATHS");
var modSearchPaths = !string.IsNullOrWhiteSpace(envModSearchPaths) ?
FieldLoader.GetValue<string[]>("MOD_SEARCH_PATHS", envModSearchPaths) :
new[] { Path.Combine(".", "mods"), Path.Combine("^", "mods") };
new[] { Path.Combine(".", "mods") };
if (args.Length == 0)
{

View File

@@ -74,16 +74,12 @@ function Version-Command
if ($version -ne $null)
{
$mods = @("mods/ra/mod.yaml", "mods/cnc/mod.yaml", "mods/d2k/mod.yaml", "mods/ts/mod.yaml", "mods/modchooser/mod.yaml", "mods/all/mod.yaml")
$mods = @("mods/ra/mod.yaml", "mods/cnc/mod.yaml", "mods/d2k/mod.yaml", "mods/ts/mod.yaml", "mods/modcontent/mod.yaml", "mods/all/mod.yaml")
foreach ($mod in $mods)
{
$replacement = (gc $mod) -Replace "Version:.*", ("Version: {0}" -f $version)
sc $mod $replacement
# The tab is a workaround for not replacing inside of "Packages:"
$replacement = (gc $mod) -Replace " modchooser:.*", (" modchooser: {0}" -f $version)
sc $mod $replacement
$prefix = $(gc $mod) | Where { $_.ToString().EndsWith(": User") }
if ($prefix -and $prefix.LastIndexOf("/") -ne -1)
{

View File

@@ -5,8 +5,6 @@ Metadata:
Hidden: true
Description: Depending on all DLLs.
RequiresMods:
Packages:
.

View File

@@ -78,12 +78,12 @@ Container@MENU_BACKGROUND:
Width: 140
Height: 35
Text: Extras
Button@MODS_BUTTON:
Button@CONTENT_BUTTON:
X: 600
Y: 0
Width: 140
Height: 35
Text: Mods
Text: Manage Content
Button@QUIT_BUTTON:
X: 750
Y: 0

View File

@@ -4,9 +4,6 @@ Metadata:
Version: {DEV_VERSION}
Author: the OpenRA Developers
RequiresMods:
modchooser: {DEV_VERSION}
Packages:
~^Content/cnc
~^Content/cnc/movies

View File

@@ -70,12 +70,12 @@ Container@MAINMENU:
Height: 30
Text: Extras
Font: Bold
Button@MODS_BUTTON:
Button@CONTENT_BUTTON:
X: PARENT_RIGHT/2-WIDTH/2
Y: 220
Width: 140
Height: 30
Text: Mods
Text: Manage Content
Font: Bold
Button@QUIT_BUTTON:
X: PARENT_RIGHT/2-WIDTH/2

View File

@@ -57,12 +57,12 @@ Container@MAINMENU:
Height: 30
Text: Extras
Font: Bold
Button@MODS_BUTTON:
Button@CONTENT_BUTTON:
X: PARENT_RIGHT/2-WIDTH/2
Y: 220
Width: 140
Height: 30
Text: Mods
Text: Manage Content
Font: Bold
Button@QUIT_BUTTON:
X: PARENT_RIGHT/2-WIDTH/2

View File

@@ -4,9 +4,6 @@ Metadata:
Version: {DEV_VERSION}
Author: the OpenRA Developers
RequiresMods:
modchooser: {DEV_VERSION}
Packages:
~^Content/d2k/v2/
~^Content/d2k/v2/GAMESFX

View File

@@ -1,169 +0,0 @@
Background@MODCHOOSER_BACKGROUND:
Background: background
Width: WINDOW_RIGHT
Height: WINDOW_BOTTOM
Background@MODCHOOSER_DIALOG:
Logic: ModBrowserLogic
Children:
Container:
X: (WINDOW_RIGHT - WIDTH) / 2
Y: (WINDOW_BOTTOM - 500) / 2
Width: 750
Height: 514
Children:
Background@DIALOG_BACKGROUND:
Y: 69
Width: PARENT_RIGHT
Height: PARENT_BOTTOM - 69
Background: panel-bg
Children:
Label:
X: 53
Y: 30
Align: Left
Font: MediumBold
Text: Choose your Battlefield:
Container@MOD_LIST:
X: 53
Y: 60
Width: PARENT_RIGHT-106
Height: 150
Children:
Button@MOD_TEMPLATE:
X: 16
Width: 114
Height: 114
TooltipContainer: TOOLTIP_CONTAINER
IgnoreChildMouseOver: true
Children:
Container@MOD_NO_LOGO:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Children:
Label@A:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM-20
Text: Missing or
Align: Center
Label@B:
Y: 20
Width: PARENT_RIGHT
Height: PARENT_BOTTOM-20
Text: invalid logo
Align: Center
RGBASprite@MOD_LOGO:
X: 9
Y: 9
Button@PREV_MOD:
X: 15
Y: 85
Width: 25
Height: 64
IgnoreChildMouseOver: true
Children:
Image:
X: 2
ImageCollection: modchooser
ImageName: leftarrow
Button@NEXT_MOD:
X: PARENT_RIGHT - WIDTH - 20
Y: 85
Width: 25
Height: 64
IgnoreChildMouseOver: true
Children:
Image:
X: 3
ImageCollection: modchooser
ImageName: rightarrow
Background@RULE:
X: 30
Y: PARENT_BOTTOM - 249
Width: PARENT_RIGHT - 60
Height: 150
Background: panel-rule
Label@MOD_TITLE:
X: PARENT_RIGHT - 400
Y: PARENT_BOTTOM-220
Align: Left
Font: Bold
Label@MOD_AUTHOR:
X: PARENT_RIGHT - 400
Y: PARENT_BOTTOM-205
Align: Left
Font: TinyBold
Label@MOD_VERSION:
X: PARENT_RIGHT - 400
Y: PARENT_BOTTOM-192
Align: Left
Font: Tiny
Label@MOD_DESC:
X: PARENT_RIGHT - 400
Y: PARENT_BOTTOM-175
Align: Left
VAlign: Top
Font: Tiny
Background@PREVIEW:
X: 30
Y: PARENT_BOTTOM - 25 - HEIGHT
Width: 300
Height: 200
Background: panel-thinborder
Children:
Label:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Text: Missing or invalid preview
Align: Center
RGBASprite@MOD_PREVIEW:
X: 2
Y: 2
Button@LOAD_BUTTON:
X: PARENT_RIGHT - 300 - WIDTH
Y: PARENT_BOTTOM - 25 - HEIGHT
Width: 100
Height: 32
Text: Play
Background: button-highlighted
Key: return
Button@CONFIGURE_BUTTON:
X: PARENT_RIGHT - 145 - WIDTH
Y: PARENT_BOTTOM - 25 - HEIGHT
Width: 140
Height: 32
Text: Manage Content
Background: button-highlighted
Button@QUIT_BUTTON:
X: PARENT_RIGHT - 30 - WIDTH
Y: PARENT_BOTTOM - 25 - HEIGHT
Width: 100
Height: 32
Text: Quit
Background: button-highlighted
Background@DIALOG_HEADER:
Width: PARENT_RIGHT
Height: 72
Background: panel-header
Children:
Image:
X: (PARENT_RIGHT - WIDTH) / 2
Y: 0-28
Width: 280
ImageCollection: modchooser
ImageName: logo
TooltipContainer@TOOLTIP_CONTAINER:
Background@BUTTON_TOOLTIP:
Logic: ButtonTooltipLogic
Background: panel-thinborder
Height: 25
Children:
Label@LABEL:
X: 5
Height: 23
Font: Bold
Label@HOTKEY:
TextColor: FFFF00
Height: 23
Font: Bold

View File

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -155,7 +155,7 @@ panel-rule: chrome.png
background: chrome.png
background:0,0,1024,480
modchooser: chrome.png
modcontent: chrome.png
logo: 0,576,280,128
leftarrow:384,512,20,64
rightarrow:404,512,20,64

View File

@@ -56,7 +56,7 @@ Background@CONTENT_PANEL:
Y: 1
Width: 20
Height: 20
ImageCollection: modchooser
ImageCollection: modcontent
ImageName: cdicon
TooltipContainer: TOOLTIP_CONTAINER
TooltipTemplate: DISC_TOOLTIP
@@ -331,60 +331,31 @@ Background@CONTENT_PROMPT_PANEL:
Height: 32
Text: Quick Install
Font: Bold
Button@BACK_BUTTON:
Button@QUIT_BUTTON:
X: PARENT_RIGHT - WIDTH - 30
Y: PARENT_BOTTOM - 52
Background: button-highlighted
Width: 110
Height: 32
Text: Back
Text: Quit
Font: Bold
Key: escape
Container@INSTALL_MOD_PANEL:
Logic: InstallModLogic
X: (WINDOW_RIGHT - WIDTH)/2
Y: (WINDOW_BOTTOM - HEIGHT)/2
Width: 500
Height: 177
Background@MODCONTENT_BACKGROUND:
Background: background
Width: WINDOW_RIGHT
Height: WINDOW_BOTTOM
Background@BUTTON_TOOLTIP:
Logic: ButtonTooltipLogic
Background: panel-thinborder
Height: 25
Children:
Background:
Width: PARENT_RIGHT
Height: PARENT_BOTTOM
Background: panel-bg
Background@RULE:
X: 30
Y: 50
Width: 440
Height: 150
Background: panel-rule
Label@TITLE:
X: 0
Y: 12
Width: PARENT_RIGHT
Height: 25
Text: Missing dependencies
Align: Center
Font: MediumBold
Label@DESC:
X: 0
Y: 65
Width: PARENT_RIGHT
Height: 25
Align: Center
Text: Please fully install the following mods then try again:
Label@MOD_LIST:
X: 0
Y: 85
Width: PARENT_RIGHT
Height: 25
Align: Center
Button@BACK_BUTTON:
X: PARENT_RIGHT - 130
Y: PARENT_BOTTOM - 52
Background: button-highlighted
Width: 110
Height: 32
Text: Back
Label@LABEL:
X: 5
Height: 23
Font: Bold
Label@HOTKEY:
TextColor: FFFF00
Height: 23
Font: Bold
Key: escape

View File

@@ -1,38 +1,35 @@
Metadata:
Title: Mod Chooser
Title: Mod Content Manager
Version: {DEV_VERSION}
Author: The OpenRA Developers
Hidden: true
RequiresMods:
Packages:
.
./mods/modchooser: modchooser
./mods/modcontent: modcontent
./mods/common: common
Cursors:
modchooser|cursors.yaml
modcontent|cursors.yaml
Chrome:
modchooser|chrome.yaml
modcontent|chrome.yaml
Assemblies:
common|OpenRA.Mods.Common.dll
ChromeLayout:
modchooser|modchooser.yaml
modchooser|content.yaml
modcontent|content.yaml
Notifications:
modchooser|notifications.yaml
modcontent|notifications.yaml
LoadScreen: ModChooserLoadScreen
Image: ./mods/modchooser/chrome.png
LoadScreen: ModContentLoadScreen
Image: ./mods/modcontent/chrome.png
ChromeMetrics:
common|metrics.yaml
modchooser|metrics.yaml
modcontent|metrics.yaml
Fonts:
Regular:

View File

@@ -4,9 +4,6 @@ Metadata:
Version: {DEV_VERSION}
Author: the OpenRA Developers
RequiresMods:
modchooser: {DEV_VERSION}
Packages:
~^Content/ra/v2/
~^Content/ra/v2/expand

View File

@@ -4,9 +4,6 @@ Metadata:
Version: {DEV_VERSION}
Author: the OpenRA Developers
RequiresMods:
modchooser: {DEV_VERSION}
Packages:
~^Content/ts
~^Content/ts/firestorm

View File

@@ -18,7 +18,7 @@ rm -rf $ROOTDIR
cd ../..
# Copy files for OpenRA.Game.exe and OpenRA.Editor.exe as well as all dependencies.
make install-all prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
make install prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"
# Install startup scripts, desktop files and icons
make install-linux-shortcuts prefix="/usr" DESTDIR="$PWD/packaging/linux/$ROOTDIR"

View File

@@ -26,10 +26,6 @@
</description>
<screenshots>
<screenshot type="default">
<image>http://www.openra.net/images/appdata/modchooser.png</image>
<caption>Mod selection screen</caption>
</screenshot>
<screenshot>
<image>http://www.openra.net/images/appdata/ingame-ra.png</image>
<caption>Red Alert mod</caption>
</screenshot>

View File

@@ -33,7 +33,7 @@ markdown Lua-API.md > Lua-API.html
# List of files that are packaged on all platforms
FILES=('OpenRA.Game.exe' 'OpenRA.Game.exe.config' 'OpenRA.Utility.exe' 'OpenRA.Server.exe'
'OpenRA.Platforms.Default.dll' \
'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modchooser' \
'lua' 'glsl' 'mods/common' 'mods/ra' 'mods/cnc' 'mods/d2k' 'mods/modcontent' \
'AUTHORS' 'COPYING' 'README.html' 'CONTRIBUTING.html' 'DOCUMENTATION.html' 'CHANGELOG.html' \
'global mix database.dat' 'GeoLite2-Country.mmdb.gz')

View File

@@ -79,7 +79,7 @@ Section "Game" GAME
File /r "${SRCDIR}\mods\cnc"
File /r "${SRCDIR}\mods\d2k"
File /r "${SRCDIR}\mods\ra"
File /r "${SRCDIR}\mods\modchooser"
File /r "${SRCDIR}\mods\modcontent"
SetOutPath "$INSTDIR"
File "${SRCDIR}\OpenRA.exe"

View File

@@ -7,12 +7,6 @@ call OpenRA.Utility.exe
echo Enter --exit to exit
set /P mod=Please enter a modname: OpenRA.Utility.exe
if /I "%mod%" EQU "--exit" (exit)
if /I "%mod%" EQU "modchooser" (
echo.
echo Sorry, this mod isn't available at the moment!
echo.
goto choosemod
)
if /I "%mod%" EQU "ra" (goto help)
if /I "%mod%" EQU "cnc" (goto help)
if /I "%mod%" EQU "ts" (goto help)