diff --git a/PlaylistManager/AffinityPatches/AnnotatedBeatmapLevelCollectionsGridViewAnimatorPatches.cs b/PlaylistManager/AffinityPatches/AnnotatedBeatmapLevelCollectionsGridViewAnimatorPatches.cs index 4155bdb..402e0d3 100644 --- a/PlaylistManager/AffinityPatches/AnnotatedBeatmapLevelCollectionsGridViewAnimatorPatches.cs +++ b/PlaylistManager/AffinityPatches/AnnotatedBeatmapLevelCollectionsGridViewAnimatorPatches.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Reflection; using System.Reflection.Emit; using HarmonyLib; using SiraUtil.Affinity; @@ -92,5 +93,21 @@ private IEnumerable OpenCollectionWithOneRow(IEnumerable FixViewportWidth(IEnumerable instructions) + { + return new CodeMatcher(instructions) + .PrintInstructions() + .MatchStartForward( + new CodeMatch(OpCodes.Ldloc_S), + new CodeMatch(i => i.opcode == OpCodes.Call && (ConstructorInfo)i.operand == AccessTools.Constructor(typeof(Vector2)))) + .ThrowIfInvalid() + .SetInstruction(new CodeInstruction(OpCodes.Ldarg_0)) + .Insert(Transpilers.EmitDelegate>(animator => + ((animator._columnCount - animator._visibleColumnCount) * 2 + animator._visibleColumnCount) * animator._columnWidth)) + .InstructionEnumeration(); + } } }