Skip to content

Commit

Permalink
fix: (again x 2) game crashes during ssc2023 "down the drain" room tr…
Browse files Browse the repository at this point in the history
…ansition
  • Loading branch information
DemoJameson committed Dec 19, 2023
1 parent 0deeb0a commit e2ab712
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions CelesteTAS-EverestInterop/Source/EverestInterop/DesyncFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ private static void Load() {
// System.IndexOutOfRangeException: Index was outside the bounds of the array.
// https://discord.com/channels/403698615446536203/1148931167983251466/1148931167983251466
On.Celeste.LightingRenderer.SetOccluder += IgnoreSetOccluderCrash;
On.Celeste.LightingRenderer.SetCutout += IgnoreSetCutoutCrash;
}

[Unload]
private static void Unload() {
On.Celeste.LightingRenderer.SetOccluder -= IgnoreSetOccluderCrash;
On.Celeste.LightingRenderer.SetCutout -= IgnoreSetCutoutCrash;
}

private static void FixDreamMirrorDesync(DreamMirror mirror) {
Expand Down Expand Up @@ -199,6 +201,18 @@ private static void IgnoreSetOccluderCrash(On.Celeste.LightingRenderer.orig_SetO
}
}

private static void IgnoreSetCutoutCrash(On.Celeste.LightingRenderer.orig_SetCutout orig, LightingRenderer self, Vector3 center, Color mask, Vector2 light, float x, float y, float width, float height) {
try {
orig(self, center, mask, light, x, y, width, height);
} catch (IndexOutOfRangeException e) {
if (Manager.Running) {
e.Log(LogLevel.Debug);
} else {
throw;
}
}
}

private static void PreventEmoteMod(ILCursor ilCursor, ILContext ilContext) {
if (ilCursor.TryGotoNext(
ins => ins.OpCode == OpCodes.Call,
Expand Down

0 comments on commit e2ab712

Please sign in to comment.