Skip to content

Commit fc249c1

Browse files
committed
improved data hook system
1 parent d106ba3 commit fc249c1

13 files changed

Lines changed: 9 additions & 12 deletions

Runtimes/Unity/BepInEx.Unity.IL2CPP/BepInEx.Unity.IL2CPP.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
<ItemGroup>
1818
<PackageReference Include="Disarm" Version="2022.1.0-master.99" />
1919
<PackageReference Include="HarmonyX" Version="2.16.0" />
20-
<PackageReference Include="Il2CppInterop.Generator" Version="1.5.2-ci.star.7" />
21-
<PackageReference Include="Il2CppInterop.HarmonySupport" Version="1.5.2-ci.star.7" />
20+
<PackageReference Include="Il2CppInterop.Generator" Version="1.5.2-ci.star.8" />
21+
<PackageReference Include="Il2CppInterop.HarmonySupport" Version="1.5.2-ci.star.8" />
2222
<PackageReference Include="Il2CppInterop.ReferenceLibs" Version="1.0.0" IncludeAssets="compile" PrivateAssets="all"/>
23-
<PackageReference Include="Il2CppInterop.Runtime" Version="1.5.2-ci.star.7" />
23+
<PackageReference Include="Il2CppInterop.Runtime" Version="1.5.2-ci.star.8" />
2424
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" IncludeAssets="compile" PrivateAssets="all"/>
2525
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" IncludeAssets="compile" PrivateAssets="all"/>
2626
<PackageReference Include="MonoMod.Core" Version="1.3.4-star" />

Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/NativeDetour.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@ public unsafe class NativeDetour : IDetour
88
{
99
public IntPtr Target { get; }
1010
public IntPtr Detour { get; }
11-
public bool UnityFunction { get; }
1211
public bool SpecialReturnBuffer { get; }
1312
public IntPtr OriginalTrampoline { get; private set; }
1413

1514
public NativeDetour(IntPtr target, Delegate detour)
16-
: this(target, detour, false, false)
15+
: this(target, detour, false)
1716
{
1817
}
1918

20-
public NativeDetour(IntPtr target, Delegate detour, bool unityFunction, bool specialReturnBuffer)
19+
public NativeDetour(IntPtr target, Delegate detour, bool specialReturnBuffer)
2120
{
2221
Target = target;
2322
Detour = Marshal.GetFunctionPointerForDelegate(detour);
24-
UnityFunction = unityFunction;
2523
SpecialReturnBuffer = specialReturnBuffer;
2624
Apply();
2725
}
@@ -32,7 +30,7 @@ public void Apply()
3230
{
3331
return;
3432
}
35-
OriginalTrampoline = StarlightInterop.hook(Target, Detour, UnityFunction, SpecialReturnBuffer);
33+
OriginalTrampoline = StarlightInterop.hook(Target, Detour, SpecialReturnBuffer);
3634
}
3735

3836
public void Dispose()

Runtimes/Unity/BepInEx.Unity.IL2CPP/Hook/NativeDetourProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ namespace BepInEx.Unity.IL2CPP.Hook;
55

66
public class NativeDetourProvider : IDetourProvider
77
{
8-
public IDetour Create<TDelegate>(IntPtr original, TDelegate target, bool unityFunction, bool specialReturnBuffer) where TDelegate : Delegate
8+
public IDetour Create<TDelegate>(IntPtr original, TDelegate target, bool specialReturnBuffer) where TDelegate : Delegate
99
{
10-
var detour = new NativeDetour(original, target, unityFunction, specialReturnBuffer);
10+
var detour = new NativeDetour(original, target, specialReturnBuffer);
1111
return new CacheDetourWrapper(detour, target);
1212
}
1313
}

Runtimes/Unity/BepInEx.Unity.IL2CPP/StarlightInterop.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ internal static partial class StarlightInterop
1616
public static unsafe partial void init_bridge_helper([MarshalAs(UnmanagedType.LPStr)] string bridgeLibPath);
1717

1818
[LibraryImport(LIBRARY_NAME)]
19-
public static unsafe partial IntPtr hook(IntPtr target, IntPtr detour,
20-
[MarshalAs(UnmanagedType.I1)] bool unityFunction,
19+
public static unsafe partial IntPtr hook(IntPtr target, IntPtr detour,
2120
[MarshalAs(UnmanagedType.I1)] bool specialReturnBuffer);
2221

2322
[LibraryImport(LIBRARY_NAME)]
25.9 MB
Binary file not shown.
-40.8 KB
Binary file not shown.
40.8 KB
Binary file not shown.
-271 KB
Binary file not shown.
271 KB
Binary file not shown.
-39.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)