-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDynamicArrayOfPtrs.cs
More file actions
33 lines (29 loc) · 947 Bytes
/
DynamicArrayOfPtrs.cs
File metadata and controls
33 lines (29 loc) · 947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using Logging = MelonLoader.MelonLogger;
namespace FieldInjector
{
internal unsafe struct DynamicArrayOfPtrs
{
public void** m_ptr;
public int memLabelId;
public ulong size;
public ulong capacity;
public ulong Capacity
{
get => this.capacity >> 1;
set => this.capacity = value << 1 | (this.capacity & 1);
}
public void InsertReplaceNull(IntPtr value)
{
for (ulong i = 0; i < this.size; i++)
{
if (this.m_ptr[i] == null)
{
this.m_ptr[i] = (void*)value;
return;
}
}
Logging.Error($"ERROR: scanned {this.size} images and no null pointer found, cannot insert ours! Struct injection will probably not work. Go tell WNP78 on discord and let someone know that he was wrong");
}
}
}