Move mod asset validation from BlankLoadScreen.StartGame() to Game.InitializeMod()
This fixes a crash that happens when you try to launch a mod directly while its assets aren't installed. Additionally should reduce the overhead for dedicated servers (in theory).
This commit is contained in:
@@ -281,14 +281,30 @@ namespace OpenRA
|
||||
Sound.Initialize();
|
||||
|
||||
ModData = new ModData(mod, !Settings.Server.Dedicated);
|
||||
ModData.MountFiles();
|
||||
ModData.InitializeLoaders();
|
||||
if (!Settings.Server.Dedicated)
|
||||
Renderer.InitializeFonts(ModData.Manifest);
|
||||
|
||||
using (new PerfTimer("LoadMaps"))
|
||||
ModData.MapCache.LoadMaps();
|
||||
|
||||
if (Settings.Server.Dedicated)
|
||||
{
|
||||
RunDedicatedServer();
|
||||
Environment.Exit(0);
|
||||
}
|
||||
|
||||
var installData = ModData.Manifest.Get<ContentInstaller>();
|
||||
var isModContentInstalled = installData.TestFiles.All(f => File.Exists(Platform.ResolvePath(f)));
|
||||
|
||||
// Mod assets are missing!
|
||||
if (!isModContentInstalled)
|
||||
{
|
||||
InitializeMod("modchooser", new Arguments());
|
||||
return;
|
||||
}
|
||||
|
||||
ModData.MountFiles();
|
||||
ModData.InitializeLoaders();
|
||||
Renderer.InitializeFonts(ModData.Manifest);
|
||||
|
||||
if (Cursor != null)
|
||||
Cursor.Dispose();
|
||||
|
||||
@@ -320,13 +336,17 @@ namespace OpenRA
|
||||
|
||||
JoinLocal();
|
||||
|
||||
if (Settings.Server.Dedicated)
|
||||
ModData.LoadScreen.StartGame(args);
|
||||
}
|
||||
|
||||
public static void RunDedicatedServer()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Settings.Server.Map = WidgetUtils.ChooseInitialMap(Settings.Server.Map);
|
||||
Settings.Save();
|
||||
CreateServer(new ServerSettings(Settings.Server));
|
||||
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
@@ -348,11 +368,6 @@ namespace OpenRA
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
ModData.LoadScreen.StartGame(args);
|
||||
}
|
||||
|
||||
public static void LoadEditor(string mapUid)
|
||||
|
||||
@@ -41,16 +41,6 @@ namespace OpenRA.Mods.Common.LoadScreens
|
||||
Ui.ResetAll();
|
||||
Game.Settings.Save();
|
||||
|
||||
var installData = Game.ModData.Manifest.Get<ContentInstaller>();
|
||||
var isModContentInstalled = installData.TestFiles.All(f => GlobalFileSystem.Exists(Path.GetFileName(f)));
|
||||
|
||||
// Mod assets are missing!
|
||||
if (!isModContentInstalled)
|
||||
{
|
||||
Game.InitializeMod("modchooser", new Arguments());
|
||||
return;
|
||||
}
|
||||
|
||||
// Join a server directly
|
||||
var connect = Launch.GetConnectAddress();
|
||||
if (!string.IsNullOrEmpty(connect))
|
||||
|
||||
Reference in New Issue
Block a user