1
0
mirror of synced 2024-11-23 22:00:56 +01:00

Fix compatability with BepInEx BE

BepInEx.IL2CPP->BepInEx.Unity.IL2CPP
Requires switch to .NET 6 target
GetMusicInfoExAll pointer field name changes
Unhollower code namespace changed
This commit is contained in:
Matt 2022-12-03 17:35:20 -05:00
parent d2a3e3223f
commit 624258c6a7
5 changed files with 15 additions and 13 deletions

View File

@ -1,10 +1,9 @@
#if TAIKO_IL2CPP #if TAIKO_IL2CPP
using HarmonyLib; using HarmonyLib;
using Il2CppInterop.Common.Attributes;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem; using Il2CppSystem;
using UnhollowerBaseLib;
using UnhollowerBaseLib.Attributes;
using UnhollowerBaseLib.Runtime;
using Il2CppException = UnhollowerBaseLib.Il2CppException;
namespace TakoTako; namespace TakoTako;
@ -20,7 +19,9 @@ public static class Il2cppRedirection
var outPtr = IntPtr.Zero; var outPtr = IntPtr.Zero;
numPtr[1] = (System.IntPtr) (&outPtr); numPtr[1] = (System.IntPtr) (&outPtr);
System.IntPtr exc = System.IntPtr.Zero; System.IntPtr exc = System.IntPtr.Zero;
var field = (System.IntPtr) AccessTools.Field(typeof(PlayDataManager), "NativeMethodInfoPtr_GetMusicInfoExAll_Public_Void_Int32_byref_ArrayOf_MusicInfoEx_0").GetValue(null); var fieldInfo = AccessTools.Field(typeof(PlayDataManager), "NativeMethodInfoPtr_GetMusicInfoExAll_Public_Void_Int32_byref_Il2CppStructArray_1_MusicInfoEx_0") ??
AccessTools.Field(typeof(PlayDataManager), "NativeMethodInfoPtr_GetMusicInfoExAll_Public_Void_Int32_byref_ArrayOf_MusicInfoEx_0");
var field = (System.IntPtr)fieldInfo.GetValue(null);
IL2CPP.il2cpp_runtime_invoke(field, IL2CPP.Il2CppObjectBaseToPtrNotNull(instance), (void**) numPtr, ref exc); IL2CPP.il2cpp_runtime_invoke(field, IL2CPP.Il2CppObjectBaseToPtrNotNull(instance), (void**) numPtr, ref exc);
dst = new Il2CppStructArray<MusicInfoEx>(outPtr); dst = new Il2CppStructArray<MusicInfoEx>(outPtr);
Il2CppException.RaiseExceptionIfNecessary(exc); Il2CppException.RaiseExceptionIfNecessary(exc);

View File

@ -12,8 +12,7 @@ using System.Threading.Tasks;
using BepInEx.Logging; using BepInEx.Logging;
using HarmonyLib; using HarmonyLib;
#if TAIKO_IL2CPP #if TAIKO_IL2CPP
using UnhollowerBaseLib; using Il2CppInterop.Runtime.InteropTypes.Arrays;
using BepInEx.IL2CPP.Utils.Collections;
using Object = Il2CppSystem.Object; using Object = Il2CppSystem.Object;
#endif #endif
using Newtonsoft.Json; using Newtonsoft.Json;

View File

@ -3,9 +3,11 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using HarmonyLib; using HarmonyLib;
using UnityEngine; using UnityEngine;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes;
#if TAIKO_IL2CPP #if TAIKO_IL2CPP
using Array = Il2CppSystem.Array; using Array = Il2CppSystem.Array;
using UnhollowerBaseLib;
#endif #endif
namespace TakoTako.Patches; namespace TakoTako.Patches;

View File

@ -7,8 +7,8 @@ using HarmonyLib;
using TakoTako.Patches; using TakoTako.Patches;
using UnityEngine; using UnityEngine;
#if TAIKO_IL2CPP #if TAIKO_IL2CPP
using BepInEx.IL2CPP.Utils; using BepInEx.Unity.IL2CPP.Utils;
using BepInEx.IL2CPP; using BepInEx.Unity.IL2CPP;
#endif #endif
#pragma warning disable BepInEx002 #pragma warning disable BepInEx002

View File

@ -27,7 +27,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework Condition="$(DefineConstants.Contains('TAIKO_IL2CPP'))">netstandard2.1</TargetFramework> <TargetFramework Condition="$(DefineConstants.Contains('TAIKO_IL2CPP'))">net6.0</TargetFramework>
<TargetFramework Condition="$(DefineConstants.Contains('TAIKO_MONO'))">net48</TargetFramework> <TargetFramework Condition="$(DefineConstants.Contains('TAIKO_MONO'))">net48</TargetFramework>
<AssemblyName>com.fluto.takotako</AssemblyName> <AssemblyName>com.fluto.takotako</AssemblyName>
<Description>A suite of mods that allow for Custom Songs and Taiko Drum support</Description> <Description>A suite of mods that allow for Custom Songs and Taiko Drum support</Description>
@ -42,8 +42,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="$(DefineConstants.Contains('TAIKO_IL2CPP'))"> <ItemGroup Condition="$(DefineConstants.Contains('TAIKO_IL2CPP'))">
<PackageReference Include="BepInEx.IL2CPP" Version="6.0.0-be.574" IncludeAssets="compile" /> <PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.663" />
<Reference Include="$(GameDir)\BepInEx\unhollowed\*.dll" Private="false" /> <Reference Include="$(GameDir)\BepInEx\interop\*.dll" Private="false" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition="$(DefineConstants.Contains('TAIKO_MONO'))"> <ItemGroup Condition="$(DefineConstants.Contains('TAIKO_MONO'))">