Skip to content

Commit

Permalink
Bypass Il2Cpp GC
Browse files Browse the repository at this point in the history
Fixes #2
  • Loading branch information
Azn9 committed Feb 19, 2023
1 parent c378a85 commit 91ff4b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions AccuracyIndicator/Indicator/InGameIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public InGameIndicator(IntPtr intPtr) : base(intPtr)

private static readonly float DefaultY = -Utils.ConvertHeightFrom1080P(420);

private readonly List<Object> _antiGC = new();
private readonly List<Object> _hitEntries = new();
private readonly List<Object> _hitReport = new();
private GameObject _canvas;
Expand All @@ -25,6 +26,8 @@ public InGameIndicator(IntPtr intPtr) : base(intPtr)

private void Start()
{
_antiGC.Add(this);

for (float i = -140; i < 140; i += 5)
{
_hitReport.Add(new ReportRange());
Expand Down Expand Up @@ -165,6 +168,7 @@ private void Update()

private void OnDestroy()
{
_antiGC.Remove(this);
Destroy(_canvas);
}

Expand Down
4 changes: 4 additions & 0 deletions AccuracyIndicator/Indicator/VictoryIndicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public VictoryIndicator(IntPtr intPtr) : base(intPtr)
{
}

private readonly List<Object> _antiGC = new();
private GameObject _canvas;
private Text _text;
private bool _rendered;
Expand All @@ -21,6 +22,8 @@ public VictoryIndicator(IntPtr intPtr) : base(intPtr)

private void Start()
{
_antiGC.Add(this);

_canvas = new GameObject("Canvas");
_canvas.AddComponent<Canvas>();
_canvas.AddComponent<CanvasScaler>();
Expand All @@ -43,6 +46,7 @@ private void Update()

private void OnDestroy()
{
_antiGC.Remove(this);
Destroy(_canvas);
}

Expand Down
6 changes: 3 additions & 3 deletions AccuracyIndicator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]

[assembly: MelonInfo(typeof(Main), "Accuracy Indicator", "1.1.0", "Azn9", "https://github.com/Azn9/MDAccuracyIndicatorMod")]
[assembly: MelonInfo(typeof(Main), "Accuracy Indicator", "1.2.0", "Azn9", "https://github.com/Azn9/MDAccuracyIndicatorMod")]
[assembly: MelonGame("PeroPeroGames", "MuseDash")]

0 comments on commit 91ff4b6

Please sign in to comment.