Exemplo n.º 1
0
        public Task StoreImageAsync(string url, Il2CppStructArray <byte> data)
        {
            return(Task.Run(() =>
            {
                try
                {
                    if (myFileDatabase.FileStorage.Exists(url))
                    {
                        return;
                    }

                    myFileDatabase.FileStorage.Upload(url, url, new MemoryStream(data));

                    var newImageInfo = new StoredImageInfo {
                        Id = url, LastAccessed = DateTime.MinValue
                    };
                    myImageInfos.Upsert(newImageInfo);
                }
                catch (LiteException ex)
                {
                    if (Imports.IsDebugMode())
                    {
                        MelonLogger.LogWarning($"Database exception in image store handler: {ex}");
                    }
                }
            }));
        }
Exemplo n.º 2
0
        internal static float GetModifiedFireStartSkillModifier(FuelSourceItem fs)
        {
            if (fs.name.Contains("GEAR_NewsprintRoll"))
            {
                return(Settings.options.tinderBonusNewsprintRoll);
            }
            if (fs.name.Contains("GEAR_PaperStack"))
            {
                return(Settings.options.tinderBonusPaper);
            }
            if (fs.name.Contains("GEAR_Newsprint"))
            {
                return(Settings.options.tinderBonusNewsprint);
            }
            if (fs.name.Contains("GEAR_CashBundle"))
            {
                return(Settings.options.tinderBonusCash);
            }
            if (fs.name.Contains("GEAR_BarkTinder"))
            {
                return(Settings.options.tinderBonusBark);
            }
            if (fs.name.Contains("GEAR_Tinder"))
            {
                return(Settings.options.tinderBonusPlug);
            }
            if (fs.name.Contains("GEAR_CattailTinder"))
            {
                return(Settings.options.tinderBonusCattail);
            }

            MelonLogger.LogWarning("MISSING TINDER " + fs.name);
            return(0);
        }
Exemplo n.º 3
0
        private unsafe void HookICall <T>(string name, T target) where T : Delegate
        {
            var originalPointer = IL2CPP.il2cpp_resolve_icall("UnityEngine.PlayerPrefs::" + name);

            if (originalPointer == IntPtr.Zero)
            {
                MelonLogger.LogWarning($"ICall {name} was not found, not patching");
                return;
            }

            myPinnedDelegates.Add(target);
            Imports.Hook((IntPtr)(&originalPointer), Marshal.GetFunctionPointerForDelegate(target));
        }
 private static GunExtras.GunConfig LoadConfig(string filename)
 {
     if (File.Exists(filename))
     {
         GunExtras.GunConfig hand = JsonConvert.DeserializeObject <GunExtras.GunConfig>(File.ReadAllText(filename));
         return(hand);
     }
     else
     {
         MelonLogger.LogWarning("No gun config found for: " + filename);
         return(null);
     }
 }
Exemplo n.º 5
0
        private static string?GetTrackerSerial(int trackerId)
        {
            var sb = new StringBuilder(64);
            ETrackedPropertyError err = ETrackedPropertyError.TrackedProp_Success;

            OpenVR.System.GetStringTrackedDeviceProperty((uint)trackerId, ETrackedDeviceProperty.Prop_SerialNumber_String, sb, (uint)sb.Capacity, ref err);
            if (err == ETrackedPropertyError.TrackedProp_Success)
            {
                return(sb.ToString());
            }

            MelonLogger.LogWarning($"Can't get serial for tracker ID {trackerId}");
            return(null);
        }
Exemplo n.º 6
0
 public override void OnApplicationStart()
 {
     if (System.IO.File.Exists(configPath))
     {
         string json = System.IO.File.ReadAllText(configPath);
         config = JsonConvert.DeserializeObject <Config>(json);
         MelonLogger.Log("Loaded configuration for PW Accuracy");
     }
     else
     {
         config = new Config();
         MelonLogger.LogWarning($"No configuration file exists at {configPath}. Default configuration is loaded");
     }
     MelonLogger.Log("PW Accuracy configuration:");
     MelonLogger.Log(config.ToString());
 }
Exemplo n.º 7
0
        private static unsafe void PatchICall <T>(string name, out T original, string patchName) where T : MulticastDelegate
        {
            var originalPointer = IL2CPP.il2cpp_resolve_icall(name);

            if (originalPointer == IntPtr.Zero)
            {
                MelonLogger.LogWarning($"ICall {name} was not found, not patching");
                original = null;
                return;
            }

            var target = typeof(FinitizerMod).GetMethod(patchName, BindingFlags.Static | BindingFlags.NonPublic);

            Imports.Hook((IntPtr)(&originalPointer), target !.MethodHandle.GetFunctionPointer());

            original = Marshal.GetDelegateForFunctionPointer <T>(originalPointer);
        }
Exemplo n.º 8
0
        private void PlayerHooks_OnPlayerGrabObject(GameObject obj)
        {
            var col = obj.GetComponent <Collider>();
            var rb  = col.attachedRigidbody;

            if (rb == null)
            {
                MelonLogger.LogWarning("Grabbed non-RB!!!");
                return;
            }
            MelonLogger.Log($"Grabbed {rb.gameObject.name}");

            if (rb.gameObject.GetComponent <SyncedObject>() == null)
            {
                SetupSyncFor(rb.gameObject);
            }
        }
Exemplo n.º 9
0
        public static void SetValues(bool shouldLog = false)
        {
            if (vSync)
            {
                if (shouldLog)
                {
                    MelonLogger.Log("vSync enabled. Max FPS will be ignored.");
                }

                if (QualitySettings.vSyncCount != 1) // Skip if value won't change
                {
                    QualitySettings.vSyncCount = 1;
                }
            }
            else
            {
                if (QualitySettings.vSyncCount != 0)
                {
                    QualitySettings.vSyncCount = 0;
                }

                if (shouldLog)
                {
                    MelonLogger.Log("vSync: Off");
                }

                if (fps < 1)
                {
                    if (shouldLog)
                    {
                        MelonLogger.LogWarning("FPS attempted to be set to less than 1: resetting to default value of 60.");
                    }
                    fps = 60;
                }

                Application.targetFrameRate = fps;
                if (shouldLog)
                {
                    MelonLogger.Log($"FPS set to: {fps}");
                }
            }
        }
Exemplo n.º 10
0
        public async Task LoadImageAsync(string url, Action <Texture2D?> onDone)
        {
            try
            {
                if (!myFileDatabase.FileStorage.Exists(url))
                {
                    onDone(null);
                    return;
                }

                await Task.Run(() => { }).ConfigureAwait(false);

                using var imageStream = myFileDatabase.FileStorage.OpenRead(url);
                using var image       = await Image.LoadAsync <Rgba32>(imageStream).ConfigureAwait(false);

                var newImageInfo = new StoredImageInfo {
                    Id = url, LastAccessed = DateTime.UtcNow
                };
                myImageInfos.Upsert(newImageInfo);

                await FavCatMod.YieldToMainThread();

                try
                {
                    onDone(CreateTextureFromImage(image));
                }
                catch (Exception ex)
                {
                    MelonLogger.LogError($"Exception in onDone callback: {ex}");
                }
            }
            catch (Exception ex)
            {
                if (Imports.IsDebugMode())
                {
                    MelonLogger.LogWarning($"Exception in image load, will delete offending image: {ex}");
                }
                myFileDatabase.FileStorage.Delete(url);
                myImageInfos.Delete(url);
                onDone(AssetsHandler.PreviewLoading.texture);
            }
        }
Exemplo n.º 11
0
        public override void OnApplicationStart()
        {
            downloadsDirectory  = Application.dataPath.Replace("Audica_Data", "Downloads");
            customSongDirectory = Application.dataPath.Replace("Audica_Data", "CustomSongs");
            CheckFolderDirectories();
            StartSongSearch();
            var i = HarmonyInstance.Create("Song Downloader");

            FilterPanel.LoadFavorites();

            if (MelonHandler.Mods.Any(it => it.Info.SystemType.Name == nameof(SongDataLoader)))
            {
                songDataLoaderInstalled = true;
                MelonLogger.Log("Song Data Loader is installed. Enabling integration");
            }
            else
            {
                MelonLogger.LogWarning("Song Data Loader is not installed. Consider downloading it for the best experience :3");
            }
        }
Exemplo n.º 12
0
        private void Log(string condition, string stackTrace, LogType type)
        {
            var s = condition + "\n" + stackTrace;

            switch (type)
            {
            case LogType.Error:
            case LogType.Exception:
                MelonLogger.LogError(s);
                break;

            case LogType.Warning:
            case LogType.Assert:
                MelonLogger.LogWarning(s);
                break;

            default:
                MelonLogger.Log(s);
                break;
            }
        }
Exemplo n.º 13
0
        private void Save()
        {
            if (!myHadChanges)
            {
                return;
            }

            myHadChanges = false;

            try
            {
                lock (mySaveLock)
                {
                    File.WriteAllText(FileName, JSON.Dump(myPrefs, EncodeOptions.PrettyPrint));
                }
            }
            catch (IOException ex)
            {
                MelonLogger.LogWarning($"Exception while saving PlayerPrefs: {ex}");
            }
        }
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null)
            {
                return(null);
            }

            JToken token = JToken.Load(reader);

            if (_IsSupportedFunc != null && _IsSupportedFunc.Invoke(reader.Path))
            {
                if (reader.TokenType == JsonToken.String)
                {
                    if (_ReturnFunc != null)
                    {
                        return(_ReturnFunc.Invoke(token.ToObject <string>()));
                    }
                }
                else if (reader.TokenType == JsonToken.Integer) //integer is just integer
                {
                    MelonLogger.LogWarning("This Rundown has used const persistentID on their file! It may can cause crash with other mods!");
                    MelonLogger.LogWarning($" - Location: {reader.Path}");
                    var id = token.ToObject <uint>();
                    return(id);
                }
            }
            else if (reader.TokenType == JsonToken.Integer)
            {
                var id = token.ToObject <uint>();
                return(id);
            }
            else if (reader.TokenType == JsonToken.String)
            {
                MelonLogger.LogError("This Rundown has used string to unsupported items!");
                MelonLogger.LogError($" - Location: {reader.Path}");
                throw new InvalidOperationException();
            }

            return(null);
        }
Exemplo n.º 15
0
        private static void FbbIkInitPrefix(VRCFbbIkController __instance, VRCPlayer?__2, bool __3)
        {
            var vrcPlayer = __2;

            if (vrcPlayer == null)
            {
                return;
            }
            var isLocalPlayer = vrcPlayer.prop_Player_0?.prop_APIUser_0?.id == APIUser.CurrentUser?.id;

            if (isLocalPlayer != __3)
            {
                MelonLogger.LogWarning("Computed IsLocal is different from provided");
            }
            if (!isLocalPlayer)
            {
                return;
            }

            LastCalibrationWasInCustomIk = false;
            LastInitializedController    = __instance;
        }
Exemplo n.º 16
0
        private void TransportLayer_OnMessageReceived(ITransportConnection arg1, P2PMessage msg)
        {
            MessageType type = (MessageType)msg.ReadByte();

            try
            {
                switch (type)
                {
                case MessageType.GunFire:
                {
                    GunFireMessageOther gfmo          = new GunFireMessageOther(msg);
                    PlayerRep           pr            = GetPlayerRep(gfmo.playerId);
                    AmmoVariables       ammoVariables = new AmmoVariables()
                    {
                        AttackDamage   = gfmo.ammoDamage,
                        AttackType     = AttackType.Piercing,
                        cartridgeType  = Cart.Cal_9mm,
                        ExitVelocity   = gfmo.exitVelocity,
                        ProjectileMass = gfmo.projectileMass,
                        Tracer         = false
                    };
                    if ((StressLevelZero.Handedness)gfmo.handedness == StressLevelZero.Handedness.RIGHT)
                    {
                        pr.rightGunScript.firePointTransform.position = gfmo.firepointPos;
                        pr.rightGunScript.firePointTransform.rotation = gfmo.firepointRotation;
                        pr.rightGunScript.muzzleVelocity   = gfmo.muzzleVelocity;
                        pr.rightBulletObject.ammoVariables = ammoVariables;
                        pr.rightGunScript.PullCartridge();
                        pr.rightGunScript.Fire();
                    }
                    if ((StressLevelZero.Handedness)gfmo.handedness == StressLevelZero.Handedness.LEFT)
                    {
                        pr.leftGunScript.firePointTransform.position = gfmo.firepointPos;
                        pr.leftGunScript.firePointTransform.rotation = gfmo.firepointRotation;
                        pr.leftGunScript.muzzleVelocity   = gfmo.muzzleVelocity;
                        pr.leftBulletObject.ammoVariables = ammoVariables;
                        pr.leftGunScript.PullCartridge();
                        pr.leftGunScript.Fire();
                    }
                    pr.faceAnimator.faceState = Source.Representations.FaceAnimator.FaceState.Angry;
                    pr.faceAnimator.faceTime  = 5;
                    break;
                }

                case MessageType.OtherPlayerPosition:
                {
                    OtherPlayerPositionMessage oppm = new OtherPlayerPositionMessage(msg);

                    if (playerObjects.ContainsKey(oppm.playerId))
                    {
                        PlayerRep pr = GetPlayerRep(oppm.playerId);

                        pr.head.transform.position   = oppm.headPos;
                        pr.handL.transform.position  = oppm.lHandPos;
                        pr.handR.transform.position  = oppm.rHandPos;
                        pr.pelvis.transform.position = oppm.pelvisPos;
                        pr.ford.transform.position   = oppm.pelvisPos - new Vector3(0.0f, 0.3f, 0.0f);
                        pr.footL.transform.position  = oppm.lFootPos;
                        pr.footR.transform.position  = oppm.rFootPos;

                        pr.head.transform.rotation   = oppm.headRot;
                        pr.handL.transform.rotation  = oppm.lHandRot;
                        pr.handR.transform.rotation  = oppm.rHandRot;
                        pr.pelvis.transform.rotation = oppm.pelvisRot;
                        pr.footL.transform.rotation  = oppm.lFootRot;
                        pr.footR.transform.rotation  = oppm.rFootRot;
                    }

                    break;
                }

                case MessageType.OtherFullRig:
                {
                    OtherFullRigTransformMessage ofrtm = new OtherFullRigTransformMessage(msg);
                    byte playerId = ofrtm.playerId;

                    if (playerObjects.ContainsKey(ofrtm.playerId))
                    {
                        PlayerRep pr = GetPlayerRep(playerId);

                        pr.ApplyTransformMessage(ofrtm);
                    }
                    break;
                }

                case MessageType.ServerShutdown:
                {
                    foreach (PlayerRep pr in playerObjects.Values)
                    {
                        pr.Delete();
                    }
                    break;
                }

                case MessageType.Disconnect:
                {
                    byte pid = msg.ReadByte();
                    playerObjects[pid].Delete();
                    playerObjects.Remove(pid);
                    largePlayerIds.Remove(pid);
                    playerNames.Remove(pid);

                    foreach (PlayerRep pr in playerObjects.Values)
                    {
                        pr.faceAnimator.faceState = Source.Representations.FaceAnimator.FaceState.Sad;
                        pr.faceAnimator.faceTime  = 10;
                    }
                    break;
                }

                case MessageType.JoinRejected:
                {
                    MelonLogger.LogError("Join rejected - you are using an incompatible version of the mod!");
                    Disconnect();
                    break;
                }

                case MessageType.SceneTransition:
                {
                    SceneTransitionMessage stm = new SceneTransitionMessage(msg);
                    if (BoneworksSceneManager.GetCurrentSceneName() != stm.sceneName)
                    {
                        BoneworksSceneManager.LoadScene(stm.sceneName);
                    }
                    break;
                }

                case MessageType.Join:
                {
                    ClientJoinMessage cjm = new ClientJoinMessage(msg);
                    largePlayerIds.Add(cjm.playerId, cjm.steamId);
                    playerNames.Add(cjm.playerId, cjm.name);
                    playerObjects.Add(cjm.playerId, new PlayerRep(cjm.name, cjm.steamId));

                    foreach (PlayerRep pr in playerObjects.Values)
                    {
                        pr.faceAnimator.faceState = Source.Representations.FaceAnimator.FaceState.Happy;
                        pr.faceAnimator.faceTime  = 15;
                    }
                    break;
                }

                case MessageType.SetPartyId:
                {
                    SetPartyIdMessage spid = new SetPartyIdMessage(msg);
                    RichPresence.SetActivity(
                        new Activity()
                        {
                            Details = "Connected to a server",
                            Secrets = new ActivitySecrets()
                            {
                                Join = ServerId.ToString()
                            },
                            Party = new ActivityParty()
                            {
                                Id   = spid.partyId,
                                Size = new PartySize()
                                {
                                    CurrentSize = 1,
                                    MaxSize     = MultiplayerMod.MAX_PLAYERS
                                }
                            }
                        });
                    break;
                }

                case MessageType.EnemyRigTransform:
                {
                    enemyPoolManager.FindMissingPools();
                    EnemyRigTransformMessage ertm = new EnemyRigTransformMessage(msg);
                    Pool pool = enemyPoolManager.GetPool(ertm.enemyType);

                    // HORRID PERFORMANCE
                    Transform              enemyTf = pool.transform.GetChild(ertm.poolChildIdx);
                    GameObject             rootObj = enemyTf.Find("enemyBrett@neutral").gameObject;
                    BoneworksRigTransforms brt     = BWUtil.GetHumanoidRigTransforms(rootObj);
                    BWUtil.ApplyRigTransform(brt, ertm);
                    break;
                }

                case MessageType.IdAllocation:
                {
                    IDAllocationMessage iam = new IDAllocationMessage(msg);
                    GameObject          obj = BWUtil.GetObjectFromFullPath(iam.namePath);
                    if (!obj)
                    {
                        MelonLogger.LogWarning("Got IdAllocation for nonexistent object???");
                    }
                    ObjectIDManager.AddObject(iam.allocatedId, obj);

                    var so = obj.AddComponent <SyncedObject>();
                    so.ID    = iam.allocatedId;
                    so.owner = iam.initialOwner;
                    so.rb    = obj.GetComponent <Rigidbody>();

                    syncedObjects.Add(so);

                    if (so.owner != localSmallId)
                    {
                        so.rb.isKinematic = true;
                    }

                    MelonLogger.Log($"ID Allocation: {iam.namePath}, {so.ID}");
                    break;
                }

                case MessageType.ObjectSync:
                {
                    ObjectSyncMessage osm = new ObjectSyncMessage(msg);
                    GameObject        obj = ObjectIDManager.GetObject(osm.id);

                    if (!obj)
                    {
                        MelonLogger.LogError($"Couldn't find object with ID {osm.id}");
                    }
                    else
                    {
                        obj.transform.position = osm.position;
                        obj.transform.rotation = osm.rotation;
                    }
                    break;
                }

                case MessageType.ChangeObjectOwnership:
                {
                    var coom = new ChangeObjectOwnershipMessage(msg);
                    var obj  = ObjectIDManager.GetObject(coom.objectId);
                    var so   = obj.GetComponent <SyncedObject>();
                    so.owner = coom.ownerId;

                    if (so.owner == localSmallId)
                    {
                        so.rb.isKinematic     = false;
                        so.rb.velocity        = coom.linVelocity;
                        so.rb.angularVelocity = coom.angVelocity;
                    }
                    else
                    {
                        so.rb.isKinematic = true;
                    }

                    MelonLogger.Log($"Object {coom.objectId} is now owned by {coom.ownerId} (kinematic: {so.rb.isKinematic})");

                    break;
                }

                case MessageType.SetLocalSmallId:
                {
                    var slsi = new SetLocalSmallIdMessage(msg);
                    localSmallId = slsi.smallId;
                    break;
                }
                }
            }
            catch (Exception e)
            {
                MelonLogger.LogError($"Caught exception in message handler for message {type}: {e}");
            }
        }
 internal static void LogWarning(string message, params object[] parameters) => MelonLogger.LogWarning(message, parameters);
Exemplo n.º 18
0
 internal static void LogWarning(string message) => MelonLogger.LogWarning(message);
Exemplo n.º 19
0
        private static ISupportModule Initialize()
        {
            LogSupport.RemoveAllHandlers();
            if (MelonConsole.Enabled || Imports.IsDebugMode())
            {
                LogSupport.InfoHandler += MelonLogger.Log;
            }
            LogSupport.WarningHandler += MelonLogger.LogWarning;
            LogSupport.ErrorHandler   += MelonLogger.LogError;
            if (Imports.IsDebugMode())
            {
                LogSupport.TraceHandler += MelonLogger.Log;
            }

            if (MelonLoaderBase.IsVRChat)
            {
                try
                {
                    Assembly Transmtn = Assembly.Load("Transmtn");
                    if (Transmtn != null)
                    {
                        Type Transmtn_HttpConnection = Transmtn.GetType("Transmtn.HttpConnection");
                        if (Transmtn_HttpConnection != null)
                        {
                            Il2CppSystem_Console_WriteLine = typeof(Il2CppSystem.Console).GetMethods(BindingFlags.Public | BindingFlags.Static).First(x => (x.Name.Equals("WriteLine") && (x.GetParameters().Count() == 1) && (x.GetParameters()[0].ParameterType == typeof(string))));
                            if (harmonyInstance == null)
                            {
                                harmonyInstance = HarmonyInstance.Create("MelonLoader.Support.Il2Cpp");
                            }
                            harmonyInstance.Patch(Transmtn_HttpConnection.GetMethod("get", BindingFlags.Public | BindingFlags.Instance), new HarmonyMethod(typeof(Main).GetMethod("Transmtn_HttpConnection_get_Prefix", BindingFlags.NonPublic | BindingFlags.Static)), new HarmonyMethod(typeof(Main).GetMethod("Transmtn_HttpConnection_get_Postfix", BindingFlags.NonPublic | BindingFlags.Static)));
                        }
                        else
                        {
                            throw new Exception("Failed to get Type Transmtn.HttpConnection!");
                        }
                    }
                    else
                    {
                        throw new Exception("Failed to get Assembly Transmtn!");
                    }
                }
                catch (Exception ex)
                {
                    MelonLogger.LogWarning("Exception while setting up Auth Token Hider, Auth Tokens may show in Console: " + ex);
                }
            }

            ClassInjector.DoHook += Imports.Hook;
            GetUnityVersionNumbers(out var major, out var minor, out var patch);
            UnityVersionHandler.Initialize(major, minor, patch);

            SetAsLastSiblingDelegateField = IL2CPP.ResolveICall <SetAsLastSiblingDelegate>("UnityEngine.Transform::SetAsLastSibling");

            ClassInjector.RegisterTypeInIl2Cpp <MelonLoaderComponent>();
            MelonLoaderComponent.Create();

            SceneManager.sceneLoaded = (
                (SceneManager.sceneLoaded == null)
                ? new Action <Scene, LoadSceneMode>(OnSceneLoad)
                : Il2CppSystem.Delegate.Combine(SceneManager.sceneLoaded, (UnityAction <Scene, LoadSceneMode>) new Action <Scene, LoadSceneMode>(OnSceneLoad)).Cast <UnityAction <Scene, LoadSceneMode> >()
                );
            Camera.onPostRender = (
                (Camera.onPostRender == null)
                ? new Action <Camera>(OnPostRender)
                : Il2CppSystem.Delegate.Combine(Camera.onPostRender, (Camera.CameraCallback) new Action <Camera>(OnPostRender)).Cast <Camera.CameraCallback>()
                );

            return(new Module());
        }
Exemplo n.º 20
0
        private static void ProcessNextOfCoroutine(IEnumerator enumerator)
        {
            try
            {
                if (!enumerator.MoveNext()) // Run the next step of the coroutine. If it's done, restore the parent routine
                {
                    var indices = ourCoroutinesStore.Select((it, idx) => (idx, it)).Where(it => it.it.WaitCondition == enumerator).Select(it => it.idx).ToList();
                    for (var i = indices.Count - 1; i >= 0; i--)
                    {
                        var index = indices[i];
                        ourNextFrameCoroutines.Add(ourCoroutinesStore[index].Coroutine);
                        ourCoroutinesStore.RemoveAt(index);
                    }
                    return;
                }
            }
            catch (Exception e)
            {
                MelonLogger.LogError(e.ToString());
                Stop(FindOriginalCoro(enumerator)); // We want the entire coroutine hierachy to stop when an error happen
            }

            var next = enumerator.Current;

            switch (next)
            {
            case null:
                ourNextFrameCoroutines.Add(enumerator);
                return;

            case WaitForFixedUpdate _:
                ourWaitForFixedUpdateCoroutines.Add(enumerator);
                return;

            case WaitForEndOfFrame _:
                ourWaitForEndOfFrameCoroutines.Add(enumerator);
                return;

            case WaitForSeconds _:
                break;     // do nothing, this one is supported in Process

            case Il2CppObjectBase il2CppObjectBase:
                var nextAsEnumerator = il2CppObjectBase.TryCast <Il2CppSystem.Collections.IEnumerator>();
                if (nextAsEnumerator != null)     // il2cpp IEnumerator also handles CustomYieldInstruction
                {
                    next = new Il2CppEnumeratorWrapper(nextAsEnumerator);
                }
                else
                {
                    MelonLogger.LogWarning($"Unknown coroutine yield object of type {il2CppObjectBase} for coroutine {enumerator}");
                }
                break;
            }

            ourCoroutinesStore.Add(new CoroTuple {
                WaitCondition = next, Coroutine = enumerator
            });

            if (next is IEnumerator nextCoro)
            {
                ProcessNextOfCoroutine(nextCoro);
            }
        }
Exemplo n.º 21
0
 static void Prefix(Il2CppSystem.Object message)
 {
     MelonLogger.LogWarning(message.ToString());
 }
Exemplo n.º 22
0
        public static void LogWarning(string message)
        {
#if DEBUG
            MelonLogger.LogWarning(message);
#endif
        }
Exemplo n.º 23
0
 static void Prefix(Il2CppSystem.Object message, UnityEngine.Object context)
 {
     MelonLogger.LogWarning($"[{context}]: {message}");
 }