diff --git a/Celeste.Mod.mm/Patches/LevelLoader.cs b/Celeste.Mod.mm/Patches/LevelLoader.cs index 3b895dad1..819840242 100644 --- a/Celeste.Mod.mm/Patches/LevelLoader.cs +++ b/Celeste.Mod.mm/Patches/LevelLoader.cs @@ -195,7 +195,7 @@ private XmlDocument getModdedSpritesXml(string path) { [MonoModIgnore] // We don't want to change anything about the method... [PatchLoadingThreadAddEvent] // ... except for manually manipulating the method via MonoModRules - [PatchLoadingThreadAddSubHudRenderer] + [PatchLoadingThreadAddSubHudRenderer] private extern void LoadingThread(); private void LoadingThread_Safe() { @@ -214,14 +214,14 @@ private void LoadingThread_Safe() { break; } } - + string type = ""; if (e.TypeInStacktrace(typeof(SolidTiles))) { type = "fg"; } else if (e.TypeInStacktrace(typeof(BackgroundTiles))) { type = "bg"; } - + patch_LevelEnter.ErrorMessage = Dialog.Get("postcard_badtileid") .Replace("((type))", type).Replace("((id))", ex.ID.ToString()).Replace("((x))", ex.X.ToString()) .Replace("((y))", ex.Y.ToString()).Replace("((room))", room).Replace("((sid))", sid); @@ -248,9 +248,16 @@ public override void Update() { base_Update(); if (Loaded && !started) { if (patch_LevelEnter.ErrorMessage == null) { - StartLevel(); - } - else { + try { + StartLevel(); + } catch (Exception e) { + string SID = session.Area.GetSID(); + patch_LevelEnter.ErrorMessage = Dialog.Get("postcard_levelloadfailed").Replace("((sid))", SID); + Logger.Log(LogLevel.Warn, "LevelLoader", $"Failed Starting Level at room {session.Level} of {SID}"); + e.LogDetailed(); + LevelEnter.Go(session, false); + } + } else { LevelEnter.Go(session, false); // We encountered an error, so display the error screen } }