diff --git a/Tangerine/Tangerine.csproj b/Tangerine/Tangerine.csproj index a91ac4e..213185b 100644 --- a/Tangerine/Tangerine.csproj +++ b/Tangerine/Tangerine.csproj @@ -16,7 +16,10 @@ + + @@ -31,7 +34,8 @@ - + + $(mmxd_game_path)\BepInEx\interop\Assembly-CSharp.dll @@ -82,6 +86,8 @@ $(mmxd_game_path)\BepInEx\interop\ProtocolWeb.dll + + $(mmxd_game_path)\BepInEx\interop\Il2Cppmscorlib.dll @@ -94,23 +100,279 @@ $(mmxd_game_path)\BepInEx\interop\Il2CppSystem.Xml.dll + + + + $(mmxd_game_path)\BepInEx\interop\Unity.Burst.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Burst.Unsafe.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Collections.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Entities.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Entities.Hybrid.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Mathematics.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Mathematics.Extensions.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Properties.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Scenes.Hybrid.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Serialization.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Timeline.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Transforms.dll + + + $(mmxd_game_path)\BepInEx\interop\Unity.Transforms.Hybrid.dll + $(mmxd_game_path)\BepInEx\interop\UnityEngine.dll + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.AccessibilityModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.AIModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.AndroidJNIModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.AnimationModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.AssetBundleModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.AudioModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ClothModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ClusterInputModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ClusterRendererModule.dll + $(mmxd_game_path)\BepInEx\interop\UnityEngine.CoreModule.dll + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.CrashReportingModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.DirectorModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.DSPGraphModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.GameCenterModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.GIModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.GridModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.HotReloadModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ImageConversionModule.dll + $(mmxd_game_path)\BepInEx\interop\UnityEngine.IMGUIModule.dll + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.InputLegacyModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.InputModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.JSONSerializeModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.LocalizationModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ParticleSystemModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.PerformanceReportingModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.Physics2DModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.PhysicsModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ProfilerModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.ScreenCaptureModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.SharedInternalsModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.SpriteMaskModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.SpriteShapeModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.StreamingModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.SubstanceModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.SubsystemsModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.TerrainModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.TerrainPhysicsModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.TextCoreModule.dll + $(mmxd_game_path)\BepInEx\interop\UnityEngine.TextRenderingModule.dll + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.TilemapModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.TLSModule.dll + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UI.dll + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UIElementsModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UIElementsNativeModule.dll + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UIModule.dll + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UmbraModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UNETModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityAnalyticsCommonModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityAnalyticsModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityConnectModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityCurlModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityTestProtocolModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityWebRequestAssetBundleModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityWebRequestAudioModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityWebRequestModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityWebRequestTextureModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.UnityWebRequestWWWModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.VehiclesModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.VFXModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.VideoModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.VirtualTexturingModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.VRModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.WindModule.dll + + + $(mmxd_game_path)\BepInEx\interop\UnityEngine.XRModule.dll + + + + + $(mmxd_game_path)\BepInEx\core\0Harmony.dll + + + $(mmxd_game_path)\BepInEx\core\BepInEx.Core.dll + + + $(mmxd_game_path)\BepInEx\core\BepInEx.Preloader.Core.dll + + + $(mmxd_game_path)\BepInEx\core\BepInEx.Unity.Common.dll + + + $(mmxd_game_path)\BepInEx\core\BepInEx.Unity.IL2CPP.dll + + + $(mmxd_game_path)\BepInEx\core\Il2CppInterop.Common.dll + + + $(mmxd_game_path)\BepInEx\core\Il2CppInterop.Generator.dll + + + $(mmxd_game_path)\BepInEx\core\Il2CppInterop.HarmonySupport.dll + + + $(mmxd_game_path)\BepInEx\core\Il2CppInterop.Runtime.dll + + + $(mmxd_game_path)\BepInEx\core\Cpp2IL.Core.dll + + + $(mmxd_game_path)\BepInEx\core\LibCpp2IL.dll + diff --git a/Tangerine/Utils/Il2CppHelpers.cs b/Tangerine/Utils/Il2CppHelpers.cs new file mode 100644 index 0000000..888cca5 --- /dev/null +++ b/Tangerine/Utils/Il2CppHelpers.cs @@ -0,0 +1,92 @@ +using CallbackDefs; +using Il2CppInterop.Runtime; +using Il2CppInterop.Runtime.InteropTypes; +using Il2CppInterop.Runtime.InteropTypes.Arrays; +using StageLib; +using System; +using UnityEngine; + +namespace Tangerine.Utils +{ + public static class Il2CppHelpers + { + /// + /// Alternative implementation of + /// + public static void FxManagerPlay(string p_fxName, Vector3 p_worldPos, Quaternion p_quaternion, Il2CppReferenceArray p_params = null) + { + if (MonoBehaviourSingleton.Instance.IsPreload(p_fxName)) + { + FxBase poolObj = MonoBehaviourSingleton.Instance.GetPoolObj(p_fxName); + poolObj.transform.SetParent(null); + poolObj.transform.SetPositionAndRotation(p_worldPos, p_quaternion); + FxManager.Instance.RegisterFxBase(poolObj); + poolObj.Active(p_params); + if (p_params != null && p_params.Length != 0) + { + StageFXParam stageFXParam = p_params[0] as StageFXParam; + if (stageFXParam != null) + { + if (stageFXParam.tFOL != null) + { + stageFXParam.tFOL.tObj = poolObj.gameObject; + } + FxManager.Instance.ChangeFXColor(poolObj, stageFXParam); + return; + } + } + } + else + { + FxManager.Instance.PreloadFx(p_fxName, 1, (Callback)(new Action(() => FxManagerPlay(p_fxName, p_worldPos, p_quaternion, p_params)))); + } + } + + /// + /// Alternative implementation of + /// + public static void FxManagerPlay(string pFxName, Transform pTransform, Quaternion pQuaternion, Il2CppReferenceArray pParams = null) + { + if (MonoBehaviourSingleton.Instance.IsPreload(pFxName)) + { + FxBase poolObj = MonoBehaviourSingleton.Instance.GetPoolObj(pFxName); + Vector3 localScale = poolObj.transform.localScale; + poolObj.transform.SetParent(pTransform); + poolObj.transform.localPosition = Vector3.zero; + poolObj.transform.localRotation = pQuaternion; + poolObj.transform.localScale = localScale; + FxManager.Instance.RegisterFxBase(poolObj); + poolObj.Active(pParams); + if (pParams != null && pParams.Length != 0) + { + StageFXParam stageFXParam = pParams[0] as StageFXParam; + if (stageFXParam != null) + { + if (stageFXParam.tFOL != null) + { + stageFXParam.tFOL.tObj = poolObj.gameObject; + } + FxManager.Instance.ChangeFXColor(poolObj, stageFXParam); + return; + } + } + } + else + { + FxManager.Instance.PreloadFx(pFxName, 1, (Callback)(new Action(() => FxManagerPlay(pFxName, pTransform, pQuaternion, pParams)))); + } + } + + /// + /// Sets the value of a field + /// + /// Enclosed type + /// Object that contains the field + /// NativeFieldInfoPtr of the field + /// value to set + public static unsafe void SetNullable(Il2CppObjectBase obj, IntPtr ptr, Il2CppSystem.Nullable_Unboxed value) where T : unmanaged + { + *(Il2CppSystem.Nullable_Unboxed*)(IL2CPP.Il2CppObjectBaseToPtrNotNull(obj) + (int)IL2CPP.il2cpp_field_get_offset(ptr)) = value; + } + } +}